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

The Cost of Hydration: CPU and Time to Interactive

Large apps can have slow Time-to-Interactive due to hydration parsing and executing all component code.

The Cost of Hydration: CPU and Time to Interactive

What you'll learn: Why large React applications can feel sluggish after the initial HTML appears, even with server-side rendering.

The Hidden Performance Tax

You've learned that hydration attaches event listeners to server-rendered HTML, making it interactive. But here's the catch: hydration requires the browser to parse, compile, and execute all your JavaScript before anything becomes clickable.

For small apps, this happens almost instantly. But for large applications with hundreds of components and dependencies, hydration can take seconds. During this time, users see a fully-rendered page but can't interact with it—buttons don't respond, forms don't work, links feel broken. This is called a Time to Interactive (TTI) problem.

Why Hydration Is Expensive

The browser must:

  1. Download all component JavaScript (even for components users might never interact with)
  2. Parse that JavaScript into bytecode
  3. Execute every component's code to rebuild the virtual DOM tree
  4. Match the virtual tree against the real DOM
  5. Attach event listeners to make things interactive

Each step consumes CPU cycles. On slower devices or networks, users might wait 3-5 seconds staring at a "frozen" page that looks ready but isn't.

The Performance Paradox

Server-side rendering improves perceived performance (users see content faster), but without optimization, it can worsen actual interactivity. The gap between "I can see it" and "I can use it" becomes frustratingly long.

Key Takeaway: Hydration requires parsing and executing all component code, which can delay Time to Interactive for large apps—users see HTML but can't interact until JavaScript finishes hydrating the entire tree.