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

Bootstrapping the Client After SSR

How the server-rendered HTML includes scripts to queue client-side hydration once JavaScript loads.

Bootstrapping the Client After SSR

What you'll learn: How React transforms server-rendered HTML into an interactive application once JavaScript loads in the browser.

The Gap Between Static and Interactive

When your server sends HTML to the browser using renderToPipeableStream, the user sees content immediately—but it's just static markup. Buttons don't respond to clicks, forms don't validate, and interactive features are frozen. The HTML is there, but React isn't "alive" yet on the client.

The Bootstrap Process

The server-rendered HTML includes <script> tags that tell the browser to download your JavaScript bundle. Once that JavaScript loads, React performs hydration—it attaches event listeners, initializes state, and "wakes up" the interactive parts of your application.

Here's the key: React doesn't re-render everything. Instead, it assumes the DOM already matches what it would have rendered, so it just connects the dots between the existing HTML and your component tree.

Scripts and the Hydration Queue

The HTML from the server includes special <script> tags that:

  • Load your application's JavaScript bundle
  • Queue any Suspense boundaries that resolved late (streamed after the initial shell)
  • Tell React which parts of the page need hydration

The browser processes these scripts in order, gradually making different parts of the page interactive—first the shell, then any streamed content as it arrives.

Key Takeaway: Server-rendered HTML includes embedded scripts that load your JavaScript bundle and queue client-side hydration, transforming static HTML into a fully interactive React application once the code downloads.