Course contentsShow
← React
Lesson 1646 of 2,39640. Server-Side RenderingFree lesson

Hydration Order: Root to Leaves, Synchronous by Default

React hydrates the entire tree synchronously from root down, blocking the main thread until complete.

Hydration Order: Root to Leaves, Synchronous by Default

What you'll learn: How React processes the entire component tree during hydration and why it blocks the main thread.

The Top-Down, All-at-Once Process

When React hydrates server-rendered HTML, it doesn't pick and choose which parts to process first. Instead, it starts at the root of your component tree and works its way down to every leaf, attaching event listeners and reconciling state in a single, uninterrupted pass.

This is synchronous by default, meaning React blocks the main thread until the entire tree is hydrated. The browser can't respond to user clicks, inputs, or scrolling until hydration completes.

Why This Matters

Think of hydration like painting a house from top to bottom with one continuous stroke—you can't stop halfway and expect someone to move in. React must ensure the entire tree is "alive" before any interactive features work reliably.

During this process:

  • React walks through every component in order
  • It attaches event handlers to matching DOM nodes
  • It sets up state and effects
  • Nothing else can happen on the main thread

If you have a large component tree, this can take hundreds of milliseconds, during which the page appears interactive but doesn't respond to clicks—a frustrating user experience known as "uncanny valley" interactivity.

The Single-Pass Approach

React doesn't hydrate components based on viewport visibility or user intent. It hydrates everything, everywhere, all at once. A component at the bottom of a 10-page document gets hydrated even if the user never scrolls there.

Key Takeaway: React's default hydration is a synchronous, root-to-leaves traversal that blocks the main thread until complete, making large trees feel unresponsive during the initial hydration phase.