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

The Three Phases of React Updates

Understanding the render phase, commit phase, and effects phase in React's update lifecycle.

The Three Phases of React Updates

What you'll learn: How React breaks down every update into three distinct phases—render, commit, and effects—to efficiently manage your UI.

The Three-Phase Pipeline

When you call setState, React doesn't immediately change the DOM. Instead, it runs through a carefully orchestrated three-phase process:

1. The Render Phase

React calls your component functions to figure out what the UI should look like. This phase is pure computation—React compares the old virtual DOM with the new one (reconciliation) to determine what changed. No side effects happen here; it's all about calculating the next UI state.

2. The Commit Phase

Once React knows what changed, it applies those changes to the actual DOM. This is where your browser's UI actually updates. React writes the minimal set of changes needed—it doesn't recreate the entire DOM tree, just the parts that differ.

3. The Effects Phase

After the DOM is updated and painted to the screen, React runs your useEffect callbacks (which we'll cover later). This is where side effects like data fetching, subscriptions, or manual DOM manipulations happen. Effects run after the user can see the update.

Why Three Phases?

Think of it like building a house: first you draw blueprints (render), then you construct the actual building (commit), then you move in furniture and turn on utilities (effects). Each phase has a distinct purpose and timing.

Batching (which we just learned) groups multiple updates before entering phase 1, so React can process them all in one efficient pipeline run instead of three separate trips through all phases.

Key Takeaway: Every React update flows through render → commit → effects. Understanding this pipeline helps you reason about when your code runs and why certain behaviors (like stale state or timing issues) occur.