docs/oss/building-features/streaming-server-rendering.md
:::tip Pro Feature
SSR works in the OSS version via ExecJS. Pro adds streaming SSR with renderToPipeableStream and Suspense for progressive rendering. See the Streaming SSR guide or upgrade to Pro →
:::
React on Rails Pro supports streaming server rendering using React 18/19's renderToPipeableStream API. Instead of waiting for the entire page to render before sending any HTML, streaming SSR sends HTML to the browser progressively as each part of the page becomes ready.
Traditional SSR renders the full page on the server, then sends the complete HTML in one response. This means the user sees nothing until the slowest component finishes rendering. Streaming SSR changes this:
<Suspense> boundaries define which parts can stream independentlyrenderToPipeableStream to render React components<Suspense> boundary resolves (e.g., an async data fetch completes), the rendered HTML chunk is streamed to the browserimport React, { Suspense } from 'react';
const ProductPage = () => (
<>
<Suspense fallback={<div>Loading details...</div>}>
<ProductDetails />
</Suspense>
<Suspense fallback={<div>Loading reviews...</div>}>
<ProductReviews />
</Suspense>
</>
);
class ProductsController < ApplicationController
include ActionController::Live
include ReactOnRails::Controller
include ReactOnRailsPro::Stream
def show
stream_view_containing_react_components(template: 'products/show')
end
end
<%= stream_react_component('ProductPage', props: { id: @product.id }) %>
For implementation steps, compression middleware compatibility, script loading strategies, metadata handling, immediate hydration, and best practices, see the Streaming SSR guide.