Next.js & App Router (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
Streaming SSR with `<Suspense>`: Progressive HTML and RSC Payload.
senior LevelCode ExampleSSR & HydrationSystem Design
In Simple Words:
In traditional SSR, if one database query on the page takes 3 seconds, the entire page blocks, and the user stares at a blank screen for 3 seconds.
Streaming SSR:
Next.js sends the instant static shell (Header, Sidebar) immediately, wraps slow components in <Suspense>, and streams the HTML and RSC chunks as soon as data resolves:
tsx
import { Suspense } from 'react';
import Header from './Header';
import SlowReviews from './SlowReviews';
import ReviewsSkeleton from './ReviewsSkeleton';
export default function ProductPage() {
return (
<div>
<Header /> {/* Renders immediately! */}
<Suspense fallback={<ReviewsSkeleton />}>
<SlowReviews /> {/* Streams down 3 seconds later without blocking! */}
</Suspense>
</div>
);
}