Commit Phase
February 9, 20261 min readpart 04/13
The commit phase is synchronous — once started, it runs to completion. This prevents partially-updated UI. Three sub-phases:
1. Before Mutation
Calls getSnapshotBeforeUpdate for class components. Schedules passive effects (useEffect) but doesn't flush them yet.
2. Mutation
Actual DOM operations: insertions, updates, deletions. Runs componentWillUnmount, useLayoutEffect cleanups, and detaches refs from old nodes.
3. Layout
Runs componentDidMount/componentDidUpdate, fires useLayoutEffect callbacks synchronously (before paint), and attaches refs to new DOM nodes.
After layout, React swaps root.current to the WIP tree. Then asynchronously, after the browser paints, it flushes passive effects.
Render Phase (interruptible) Commit Phase (synchronous)
┌─────────────────────────┐ ┌────────────────────────────────────┐
│ beginWork → completeWork│───→│ beforeMutation → mutation → layout │
│ (builds WIP tree) │ │ (applies changes to DOM) │
└─────────────────────────┘ └──────────────┬─────────────────────┘
│
▼ (async, after paint)
Passive Effects (useEffect)Further reading
- How the Commit Phase Works (deep dive) jser.dev traces mutation, layout, and passive effect phases in source
- A (Mostly) Complete Guide to React Rendering (article) Mark Erikson covers the full render → commit pipeline and batching
- ReactFiberCommitWork.js (source) The actual commit phase implementation in the React repo
- Before You memo() (article) Dan Abramov on render vs. commit costs and when optimization matters