All projects / HookViz
HookViz
A step-by-step React hooks visualizer. Watch useState, useEffect, useReducer and more run line by line, with the source, hook list, DOM and effects queue in sync.
- Source, hooks, DOM, effects queue and variables stay in sync at every step
- Guided and Expert modes, with a step player and speed control
- Traces recorded at build time, replayed by a static Next.js player
What it is
A step-by-step visualizer for React hooks. It replays real React executions one statement at a time, so you can see the source line, the hook list, the effects queue and the DOM change together. A stale closure or a missing dependency shows up as a step you can point at.
Recorded, not simulated
Each example is a real component recorded under a debugger. The recording captures hook state, effects, DOM commits and variable values at every pause. The traces are recorded at build time and replayed by a static Next.js player, so every visit shows the same run.
Six views of one moment
Source, rendered output, hooks, effects queue, variables and a timeline all show the same step, so moving the timeline moves every panel. Four phases are colour-coded: render, commit, passive effect and event. A player gives play, pause, step and seek, with speed from 0.5x to 4x, and a Guided or Expert toggle shows or hides annotations in the gutter.
22 examples
The examples are grouped by hook and start with the common gotchas: why two setCount calls only increment once, stale closures, and fetch races. They cover useState, useEffect, useLayoutEffect, useRef, useMemo, useCallback, useReducer, useDeferredValue, useOptimistic, useContext and useTransition, on React 19.
Open source
The code is public on GitHub, and new examples are welcome through a contributing guide.