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

renderToString vs renderToPipeableStream: The Modern Choice

Why streaming is preferred for production: better TTFB, progressive rendering, and Suspense support.

renderToString vs renderToPipeableStream: The Modern Choice

What you'll learn: Why modern React apps prefer streaming SSR over traditional string-based rendering for production.

The Performance Difference

You've seen both renderToString and renderToPipeableStream in action. Now let's understand why streaming has become the production standard.

renderToString blocks the entire server until every component finishes rendering. It's like waiting for an entire meal to be cooked before the waiter brings anything to your table. The browser sees nothing until the full HTML string is ready.

renderToPipeableStream starts sending HTML immediately. It's like ordering courses at a restaurant—appetizers arrive first, then the main course, then dessert. The browser receives and displays content progressively.

Why Streaming Wins

Better TTFB (Time to First Byte): With streaming, the server sends the initial shell instantly via onShellReady. Users see something in milliseconds, not seconds. With renderToString, TTFB equals your slowest component.

Progressive Rendering: As chunks of HTML arrive, browsers start parsing and displaying them immediately. Users see content loading progressively rather than staring at a blank screen.

Suspense Support: Streaming is the only way to leverage Suspense boundaries for SSR. Components wrapped in Suspense can stream in later without blocking the initial response. renderToString completely ignores Suspense—it waits for everything.

The Modern Standard

Production React apps default to renderToPipeableStream because:

  • Users perceive faster load times (content appears sooner)
  • Server memory usage is lower (no giant string in RAM)
  • Suspense unlocks powerful loading patterns
  • Better user experience under slow network conditions

Key Takeaway: Use renderToPipeableStream for production—it delivers better TTFB, enables progressive rendering, and is the only way to leverage Suspense boundaries in SSR. Reserve renderToString for simple tools or debugging.