SSR & Streaming in React
From the React Router v7 cheat sheet · Framework Mode Features · verified Jul 2026
SSR & Streaming
Server-side rendering and HTML streaming in Framework Mode
typescript
// app/root.tsx - Framework Mode root
import {
Links,
Meta,
Outlet,
Scripts,
ScrollRestoration,
useLoaderData
} from "react-router"
export function Layout({ children }) {
return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Links />
</head>
<body>
{children}
<ScrollRestoration />
<Scripts />
</body>
</html>
)
}
// Server-only loader
export async function loader() {
// This only runs on the server
const data = await db.query("SELECT * FROM products")
return { products: data }
}
export default function App() {
const { products } = useLoaderData<typeof loader>()
return <Outlet />
}💡 Framework Mode enables SSR and streaming out of the box
⚡ Use defer() to stream non-critical data
📌 .server files only run on server, never bundled to client
🟢 Route modules run on server and client; use .server/.client file suffixes to control bundling (RSC + "use client" is a separate experimental feature)
ssrstreamingframeworkserver