Course contentsShow
← React
Lesson 560 of 2,39615. useEffect FundamentalsFree lesson

The Render-Commit-Paint-Effect Sequence

Understanding React's four-phase execution model and where useEffect fits in the browser update cycle.

The Render-Commit-Paint-Effect Sequence

What you'll learn: The exact order of React's four-phase execution model and where useEffect fits in the browser update cycle.

The Four Phases

When a component updates, React executes four distinct phases in a specific order:

1. Render Phase

React calls your component function to determine what the UI should look like. This is when props and state are read, JSX is created, and your component code runs. This phase is "pure" — no side effects allowed.

2. Commit Phase

React takes the results from the render phase and applies changes to the actual DOM. Elements are created, updated, or removed. This happens synchronously and very quickly.

3. Paint Phase

The browser takes the updated DOM and paints pixels to the screen. This is when users actually see the changes visually. React doesn't control this — the browser does.

4. Effect Phase

After the browser has painted, React runs all your useEffect callbacks. This is why effects run "after commit" — the DOM is updated and visible before your effect code executes.

Why This Order Matters

The sequence ensures users see visual updates as quickly as possible. If effects ran during render or commit, they could slow down what appears on screen. By running effects after paint, React keeps the UI responsive even if your effect does something slow.

This also explains why you can't prevent the initial render from showing — by the time your effect runs to (say) fetch data, the component has already painted.

Key Takeaway: React follows a strict four-phase sequence: Render → Commit → Paint → Effect. Your useEffect code runs after users can see the updated UI, making it safe for side effects but too late to prevent the initial display.