New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-debug-updates

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-debug-updates

See why React components re-render — visual overlays, console logging, and hook-level cause detection with zero code changes

Source
npmnpm
Version
0.1.7
Version published
Weekly downloads
1.6K
Maintainers
1
Weekly downloads
 
Created
Source

react-debug-updates

Visual debugging overlays and console logging for React re-renders. See exactly which components re-render, how often, how long they take, and why they re-rendered — all without modifying your components.

highlight overlays zero config

demo

How it works

Hooks into __REACT_DEVTOOLS_GLOBAL_HOOK__ to intercept every React commit. Works in any React web environment — browsers, Electron, iframes — no React DevTools extension required. No wrappers, no HOCs, no code changes — just call attachRenderLogger() and you get:

  • Console logging — grouped, color-coded re-render reports with component tree paths and render durations
  • Visual overlays — highlight boxes on re-rendered DOM nodes with a heat-map color scale (blue → red as render count increases)
  • Cause detection — pinpoint which useState, useReducer, useSyncExternalStore, or useContext hook triggered each re-render, with previous→next values

Install

npm install react-debug-updates
# or
yarn add react-debug-updates
# or
pnpm add react-debug-updates

Quick start

Import and call attachRenderLogger before React renders anything — ideally at the very top of your entry point. This ensures the hook is in place before the first commit.

import { attachRenderLogger } from "react-debug-updates";

// Call before React renders — top of your entry point
const logger = attachRenderLogger({
  highlight: true,
  showCauses: true,
});

// Later, to clean up:
logger?.disconnect();

Dev-only guard

if (process.env.NODE_ENV === "development") {
  const { attachRenderLogger } = await import("react-debug-updates");
  attachRenderLogger({ highlight: true, showCauses: true });
}

Requirements

  • A React dev build (which automatically creates __REACT_DEVTOOLS_GLOBAL_HOOK__) — no browser extension needed
  • For showCauses and render durations: React must be in dev mode (provides _debugHookTypes and actualDuration on fibers)

API

attachRenderLogger(options?): RenderLogger | null

Returns a RenderLogger handle, or null if the DevTools hook is not available.

Options

OptionTypeDefaultDescription
silentbooleanfalseSuppress console output
mode"self-triggered" | "all""self-triggered""self-triggered" tracks only components whose own state changed. "all" includes children swept by parent updates
bufferSizenumber500Max entries kept in the ring buffer
filter(entry: RenderEntry) => booleanReturn false to skip an entry
highlightboolean | HighlightOptionsfalseEnable visual overlay highlights
showCausesbooleanfalseDetect and display why each component re-rendered

HighlightOptions

OptionTypeDefaultDescription
flushIntervalnumber250Milliseconds between overlay flush cycles
animationDurationnumber1200Overlay fade-out animation duration (ms)
showLabelsbooleantrueShow text labels (name, count, duration, cause) above overlays
opacitynumber0.3Peak opacity of overlay highlights (0–1)

RenderLogger

PropertyTypeDescription
entriesRenderEntry[]Ring buffer of recorded re-render entries
disconnect() => voidUnhook from React and remove all overlays

RenderEntry

PropertyTypeDescription
componentstringComponent display name
pathstringAncestor component path (e.g. "App → Layout → Sidebar")
durationnumberRender duration in ms (requires React dev mode)
timestampnumberperformance.now() when the entry was recorded
causesUpdateCause[]Why this component re-rendered (requires showCauses)

UpdateCause

PropertyTypeDescription
kind"hook" | "props" | "class-state" | "unknown"Category of the cause
hookIndexnumber?Source-order index of the hook (0-based)
hookTypestring?e.g. "useState", "useReducer", "useContext"
previousValueunknown?Previous hook state value
nextValueunknown?New hook state value

Console output

⚛ 3 re-renders
  Counter  App → Dashboard (0.42ms)
    ↳ useState[0]: 5 → 6
  TodoList  App → Dashboard (1.03ms)
    ↳ props changed (parent re-rendered)
  Sidebar  App (0.15ms)
    ↳ useContext changed

Visual overlays

Re-rendered components get a highlight box that fades out. The color shifts from blue to red as the same node re-renders repeatedly within a flush window — making "hot" components visually obvious.

Each overlay label shows: ComponentName ×count duration (cause)

License

MIT

Keywords

react

FAQs

Package last updated on 10 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts