npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-debug-overlay

v0.1.1

Published

In-app React debugging overlay for renders, props, state, and network activity.

Readme

React Debug Overlay

In-app React debugging overlay for renders, prop diffs, network activity, runtime errors, inspect mode, and event correlation.

This project currently contains two parts:

  • A TypeScript library built from src/
  • A Vite playground app used to exercise the overlay locally

Current MVP

  • Toggleable in-app overlay via enableDebugOverlay()
  • Render tracking with useDebugTrack()
  • Prop diff snapshots for tracked components
  • fetch and XMLHttpRequest logging
  • Runtime error capture for console.error, uncaught errors, and unhandled rejections
  • Inspect mode for tracked components
  • Grouped and filtered render feed
  • Unified timeline across renders, network, and errors
  • Timeline search plus selected-component scope mode
  • Click-to-pin for render, timeline, network, and error events
  • Export/import of debug snapshots
  • Persisted overlay UI preferences
  • Playground app for local testing

Install

Local development:

npm install

Published package usage:

npm install react-debug-overlay

Scripts

npm run dev
npm run build
npm run build:playground
npm run preview:playground
npm run clean

Script meanings:

  • npm run dev: start the Vite playground in development mode
  • npm run build: build the library from src/ using tsup
  • npm run build:playground: build the playground app into playground-dist/
  • npm run preview:playground: preview the built playground output
  • npm run clean: remove generated library and playground build output

Basic Usage

Enable the overlay in development:

import { enableDebugOverlay } from "react-debug-overlay";

enableDebugOverlay();

Track a component and attach the returned ref to a DOM node:

import { useDebugTrack } from "react-debug-overlay";

type ProfileCardProps = {
  name: string;
  online: boolean;
};

export function ProfileCard(props: ProfileCardProps) {
  const debugRef = useDebugTrack("ProfileCard", props);

  return (
    <section ref={debugRef}>
      <h2>{props.name}</h2>
      <p>{props.online ? "online" : "offline"}</p>
    </section>
  );
}

Overlay API

enableDebugOverlay(options?)

Creates the overlay once and returns a controller.

Relevant options today:

  • hotkey: keyboard shortcut, defaults to Alt+D
  • title: overlay title
  • trackNetwork: enable fetch and XHR logging
  • trackErrors: enable runtime error capture
  • zIndex: overlay z-index
  • initialDock: one of bottom-right, bottom-left, top-right, top-left
  • initialSize: one of compact, default, expanded
  • initialRenderFilter: initial render filter text
  • initialRenderGrouping: initial render grouping state
  • initialTimelineFilter: one of all, renders, network, errors
  • initialTimelineQuery: initial timeline search text
  • initialTimelineSelectedOnly: show only timeline entries tied to the selected tracked component
  • persistPreferences: whether overlay UI preferences are stored in localStorage
  • preferencesStorageKey: localStorage key override
  • maxNetworkEntries: retained network items
  • maxErrorEntries: retained error items

Current overlay behavior:

  • inspect tracked components in-app
  • filter and group render activity
  • correlate renders, requests, and errors in the timeline
  • pin render, network, error, and timeline items
  • export a snapshot to JSON and import it later
  • persist overlay UI preferences across reloads

Programmatic snapshot API

The returned controller now exposes a scriptable snapshot API:

const controller = enableDebugOverlay();

const snapshot = controller.exportSnapshot();

if (snapshot) {
  localStorage.setItem("overlay-snapshot", JSON.stringify(snapshot));
}

const saved = localStorage.getItem("overlay-snapshot");

if (saved) {
  controller.importSnapshot(JSON.parse(saved)); // boolean return value
}

controller.importSnapshotFromJson(saved ?? ""); // convenience helper

controller.resetSnapshot(); // back to live mode

Controller methods

const controller = enableDebugOverlay();

controller.show();
controller.hide();
controller.toggle();
controller.exportSnapshot();
controller.importSnapshot(snapshot);
controller.importSnapshotFromJson(snapshotJson);
controller.resetSnapshot();
controller.destroy();

useDebugTrack(name, props)

Tracks renders for a React component and returns a ref that must be attached to a DOM element.

What it records:

  • Render count
  • Changed prop keys
  • Previous vs current prop values
  • Serialized prop snapshot

Playground

The local playground lives under playground/ and imports the library source through a Vite alias, so you can iterate on the package without publishing anything.

Typical workflow:

npm install
npm run dev

Then open the local Vite URL, press Alt+D, and use the playground buttons to trigger:

  • component rerenders
  • network requests
  • console errors
  • unhandled promise rejections

The overlay also supports:

  • pinning entries directly from the render, timeline, network, and error panels
  • exporting the current viewed session as JSON
  • importing a saved snapshot and switching the overlay into snapshot mode

Current Limitations

  • Component tracking is opt-in through useDebugTrack
  • Inspect mode only works for tracked components with attached refs
  • Network and error retention is in-memory only
  • Snapshot APIs are intentionally minimal and currently limited to full overlay payloads
  • The package README assumes a local or future npm release; repository and issue metadata are not configured yet

Project Layout

src/
  errors/
  inspect/
  network/
  overlay/
  react/
playground/

Next Work

  • add package repository metadata once the remote repo exists
  • add richer examples and screenshots
  • test install flow from a clean external React app