Trivia Questions3 min readPremium

React Fiber

Fiber is the reconciliation engine React has used since version 16. It replaced a recursive renderer that couldn’t stop once it started. Fiber breaks rendering into small units of work that React can pause, resume, reprioritise or throw away, which is what makes Suspense, transitions and streaming server rendering possible.

1. The problem with the old reconciler

Before Fiber, React walked the component tree with ordinary recursive function calls. The work lived on the JavaScript call stack, so a large update ran to completion in one go. If that took 200 ms, the main thread was blocked for 200 ms: typing lagged and animations dropped frames.

2. What a fiber is

A fiber is a plain JavaScript object, one per component instance or DOM element. It holds:

  • the component type and its props
  • its state and hooks
  • pointers to its child, sibling and parent (return)
  • flags describing what has to change in the DOM
  • priority information (lanes)

Because the tree is a linked list of objects on the heap, React can stop at any fiber, remember where it was, and carry on later. In effect Fiber is React’s own call stack.

3. Two phases

Render phase  (interruptible)   Commit phase  (synchronous)
---------------------------     ---------------------------
call components                 apply DOM mutations
diff against current tree       run layout effects
mark what changed               update refs
                                schedule passive effects

Render phase. React calls your components and builds a work-in-progress tree. Nothing touches the DOM, so React can pause between fibers, restart, or discard the work. This is why components must be pure: the same render may run more than once.

Commit phase. React applies all the changes in one uninterrupted pass, so the user never sees a half-updated UI. Layout effects run here; useEffect callbacks run shortly after paint. See useEffect vs useLayoutEffect.

4. Two trees

React keeps the current tree (what’s on screen) and builds a work-in-progress tree beside it. Each fiber points to its counterpart through alternate. At commit, React swaps a pointer and the work-in-progress tree becomes current. The old one is reused for the next update, which keeps allocations low.

5. Priorities

Not every update is equally urgent. Fiber assigns each one a priority (React calls them lanes):

Update Priority
Typing, clicking Highest: must feel instant
startTransition, useDeferredValue Lower: can be interrupted
Offscreen or idle work Lowest

If you type while a transition is rendering, React pauses the transition, handles the keystroke, then resumes or restarts the transition with the latest state.

6. What Fiber makes possible

  • Concurrent rendering (React 18): long renders are split into chunks and yield to the browser.
  • Suspense: a component can pause rendering while it waits for code or data. See React Suspense.
  • Transitions: keep the current UI interactive while the next one prepares.
  • Error boundaries: an error in one subtree can be caught and that subtree replaced.
  • Streaming SSR and selective hydration.

7. Does it change how you write components?

Mostly through the rules it relies on:

  • Keep render pure. No side effects, no mutation of external values during render.
  • Put side effects in effects or event handlers.
  • Use stable keys, so fibers are matched to the right items and state is preserved.

Strict Mode double-invokes components in development to surface code that breaks these rules.

Summary

Before Fiber Fiber
Traversal Recursive call stack Linked list of fiber objects
Interruptible No Yes, in the render phase
Priorities None Lanes
Enables Synchronous updates Suspense, transitions, concurrent rendering

Follow-up questions to expect

  • “Is Fiber the virtual DOM?” The fiber tree is React’s internal version of it: richer than the element objects your components return. See virtual DOM.
  • “Why can a component render twice without committing?” The render phase can be interrupted and restarted.
  • “Does concurrent rendering make my app faster?” It doesn’t reduce total work. It keeps the page responsive while the work happens, which is what INP measures.