Course contentsShow
← React
Lesson 412 of 2,39612. Rendering and BatchingFree lesson

The Commit Phase: Applying Changes to the DOM

After diffing, React synchronously applies all calculated changes to the actual DOM in the commit phase.

The Commit Phase: Applying Changes to the DOM

What you'll learn: How React takes the changes it calculated and actually updates the browser's DOM.

Two Phases, One Purpose

Remember that React's rendering process has two distinct phases: the render phase (calculating what changed) and the commit phase (applying those changes). You've learned that the render phase builds the Virtual DOM and figures out the minimal set of changes needed. Now we reach the payoff: React actually modifies the real DOM.

What Happens in the Commit Phase

After React's Fiber reconciliation engine finishes comparing the old and new Virtual DOM trees, it has a precise list of changes: "add this element," "remove that attribute," "update this text node." The commit phase is when React synchronously applies every single change to the actual browser DOM.

This phase is:

  • Synchronous: React blocks everything else and updates the DOM in one uninterrupted sequence
  • Fast: Because React already calculated the minimal changes, it's not wastefully re-rendering everything
  • Observable: This is when you'd actually see changes appear in the browser

Why Synchronous Matters

React commits synchronously to avoid a half-updated UI. Imagine if React updated half the changes, paused, then finished later—users might see a broken, inconsistent interface. By doing everything at once, React ensures the DOM moves from one consistent state to another.

The Analogy

Think of the render phase as drafting renovation plans for your house, and the commit phase as the day the construction crew shows up and executes every change at once—no stopping halfway.

Key Takeaway: The commit phase is when React synchronously applies all calculated DOM changes in one uninterrupted sequence, ensuring your UI transitions from one consistent state to another.