Fiber is React's reconciliation engine, rewritten for React 16. It represents each component instance as a fiber node, a unit of work in a linked tree (child, sibling and return pointers) that holds state, props, hooks, effects and a link to the DOM node. The previous "stack reconciler" walked the tree recursively and synchronously, so a big update blocked the main thread until it finished. Fiber turns rendering into an iterative loop over units of work that can be paused, prioritized, resumed or thrown away, with a separate synchronous commit phase. That's the foundation for error boundaries, fragments, portals, Suspense and, since React 18, concurrent rendering (transitions, useDeferredValue, selective hydration).
Before React 16, reconciliation recursed through components using the JavaScript call stack. Once it started, it couldn't stop until the whole tree was processed. A 100 ms render meant 100 ms where typing, clicks and animations froze. There was no way to say "this keystroke is more urgent than that list update".
Roughly, an object per component or host element:
{
type, key, // what it is
stateNode, // DOM node or class instance
child, sibling, return, // linked-tree pointers (enables iteration without recursion)
pendingProps, memoizedProps, memoizedState, // memoizedState holds the hooks list
updateQueue,
flags, // side effects to commit (placement, update, deletion)
lanes, // priority of pending work
alternate, // the corresponding fiber in the other tree
}
Double buffering: React keeps a current tree (what's on screen) and builds a work-in-progress tree with alternate links. When the work-in-progress tree is complete, the commit swaps them.
Updates are assigned lanes: discrete input (click, keypress) is urgent, continuous events (scroll, mousemove) come next, then default, then transitions and idle work. React processes higher lanes first and can interrupt a transition render when the user types.
const [isPending, startTransition] = useTransition();
function onChange(e) {
setQuery(e.target.value); // urgent lane
startTransition(() => setFilter(e.target.value)); // transition lane, interruptible
}
lazy and Suspense for code splitting.memoizedState, which is why call order matters).createRoot, automatic batching, transitions, streaming SSR and selective hydration.use, and better Suspense behaviour. 19.2: <Activity> to hide subtrees while preserving state.componentWillMount and similar) became unsafe because the render phase can run without a commit.Spotted a mistake or a rights concern? Report an issue