Questions
21 of 33
1Explain server-side rendering (SSR) in Next.js.
2List the benefits of Server-Side Rendering in Next.js.
3What are server components?
4How to use server components in next js?
5What is the React Server Component Payload (RSC)?
6Describe how server components are rendered.
7Describe server rendering strategies
8How can you keep Server-only Code out of the Client Environment
9What are the issues of using context provider at the root of the application?
10List dynamic functions available to server components.
11List all Dynamic APIs.
12How do we opt for Static Rendering, Dynamic Rendering and Streaming?
13Explain the difference between SSR, SSG, ISR, and CSR in Next.js. When would you choose each?
14How does getServerSideProps work internally? What is its execution context?
15What are the performance trade-offs of SSR vs SSG in a high-traffic production app?
16How does Next.js handle hydration? What is a hydration mismatch, and how do you debug it?
17What happens when getServerSideProps throws an error? How do you handle it gracefully?
18How would you architect a Next.js app that needs both personalised (SSR) and cacheable (SSG) pages at scale?
19Explain the App Router vs Pages Router SSR model differences. How does React Server Components change the SSR paradigm?
20How do React Server Components (RSC) differ from traditional SSR? Can they be used together?
21How does streaming SSR work in Next.js 13+? What role does Suspense play?
22How would you implement partial hydration or Islands Architecture in Next.js?
23Explain how Next.js handles data fetching waterfall problems in SSR and how you'd mitigate them.
24How would you implement partial hydration or Islands Architecture in Next.js?
25How do you implement caching strategies for SSR responses in Next.js? (CDN, Cache-Control, stale-while-revalidate)
26How would you reduce TTFB (Time to First Byte) in an SSR-heavy Next.js app?
27What's the difference between fetch caching in the App Router vs traditional getServerSideProps?
28How do you avoid redundant database/API calls across multiple server components on the same page?
29How do you securely handle authentication in SSR? What are the risks of passing tokens via cookies vs headers?
30How do you prevent sensitive server-side data from leaking to the client bundle?
31How would you implement role-based rendering on the server without exposing protected routes to the client?
32How do you debug SSR-only issues that don't appear in local development?
33How can we control dynamic rendering behaviour in next js?
21 / 33

How does streaming SSR work in Next.js 13+? What role does Suspense play?

Streaming SSR in Next.js 13+ allows the server to send HTML in chunks as components render, with Suspense defining loading boundaries and enabling progressive rendering without blocking the initial page load

Streaming SSR represents a fundamental shift in how Next.js renders pages. Traditional Server-Side Rendering (SSR) blocks the response until all data is fetched and all components are rendered on the server, creating a 'all or nothing' waterfall where users stare at a blank screen until everything is ready . Streaming SSR, introduced in Next.js 13 with the App Router and React 18, breaks this paradigm by allowing the server to send HTML to the browser progressively—as soon as any part of the page is ready, it streams immediately . This means users see content almost instantly, while slower components load in the background and stream in when complete. The technical foundation is React 18's renderToPipeableStream API (replacing the synchronous renderToString), combined with Suspense boundaries that mark where streaming can occur .

Traditional SSR vs Streaming SSR Comparison
How Streaming SSR Works Technically
  1. 1

    Chunked transfer encoding: The server uses HTTP/1.1's Transfer-Encoding: chunked (or HTTP/2 streaming) to send HTML in multiple chunks over time, rather than one large response .

  2. 2

    renderToPipeableStream: React 18 replaces the synchronous renderToString with this streaming API, allowing the server to start sending HTML immediately while continuing to render .

  3. 3

    Suspense boundaries: Components wrapped in Suspense become streaming boundaries—their fallback UI is sent immediately, and the real content streams later when data resolves .

  4. 4

    Selective hydration: After streaming to the client, React hydrates components selectively—prioritizing visible and interactive parts first, and hydrating streamed components as they arrive .

  5. 5

    RSC Payload integration: In Next.js, streaming also delivers the RSC Payload (binary component tree representation) alongside HTML, enabling seamless client-side navigation without full page reloads .

Suspense is the cornerstone of streaming SSR in Next.js 13+. It serves multiple critical functions: First, it defines streaming boundaries—components wrapped in Suspense become independent rendering units that can stream separately. Second, it provides fallback UI (spinners, skeletons) that renders immediately while the real component loads . Third, and most importantly, Suspense enables non-blocking rendering—the server can send the fallback and continue rendering the rest of the page, unblocking the critical path . Without Suspense, Next.js would have to wait for every component to finish before sending anything. With Suspense, you get progressive enhancement automatically: the browser displays the fallback immediately, and when the async component resolves, React seamlessly replaces it with the final content .

Suspense Patterns in Next.js 13+
Practical Benefits and Use Cases
  1. 1

    Time-to-First-Byte (TTFB) improvement: The browser starts receiving HTML immediately, often in under 100ms, even if total page render takes seconds .

  2. 2

    First Contentful Paint (FCP) optimization: Users see something—headers, navigation, skeletons—instantly, eliminating the dreaded white screen .

  3. 3

    Complex page hierarchies: Pages with multiple data dependencies (dashboards, e-commerce, social feeds) benefit most, as slow components don't block fast ones .

  4. 4

    Skeleton screens: Using Suspense fallbacks, you can show skeleton loaders that match the final layout, minimizing Cumulative Layout Shift (CLS) .

  5. 5

    CDN and edge compatibility: Streaming works through CDNs that support chunked encoding, enabling global distribution of progressive rendering .

Streaming SSR doesn't work in isolation—it integrates deeply with Next.js's App Router ecosystem. The loading.tsx file automatically creates a Suspense boundary for the entire route segment, providing a quick way to add streaming without manual Suspense imports . Server Components stream naturally because they're async by default—when you await a fetch inside a Server Component, that component becomes a streaming boundary . The RSC Payload streams alongside HTML, enabling client-side navigation to also benefit from progressive loading. Even error handling integrates: error.tsx files work within Suspense boundaries, allowing granular error recovery for streamed components .

Limitations and Considerations
  1. 1

    Client Components limitation: Only Server Components stream naturally. Client Components inside Suspense boundaries still require JavaScript to hydrate before becoming interactive, though their HTML shell streams .

  2. 2

    Over-segmentation risk: Too many Suspense boundaries can create a fragmented, jumpy user experience. Group related content thoughtfully .

  3. 3

    SEO considerations: Critical content for search engines should not be behind Suspense boundaries without careful fallback design, as some crawlers may not wait for streaming completion .

  4. 4

    Caching complexity: Streaming responses are harder to cache at the CDN level than complete HTML pages, requiring more sophisticated caching strategies .

  5. 5

    Browser compatibility: While modern browsers support chunked responses, very old browsers may not handle streaming correctly (graceful degradation to full response is automatic but may be slower) .