- React
- Server-Side Rendering, Hydration, and Server Components
React Server Components & SSR Interview Questions
React Server Components and SSR interview questions cover how modern web applications blend server and client execution, from server rendering to hydration. In full-stack and senior frontend interviews, you will be expected to articulate the difference between traditional SSR and React Server Components.
Trace the SSR pipeline from HTML streaming to client hydration, diagnose and fix hydration mismatch bugs, establish clear boundaries between Server and Client Components with use client, and use selective hydration with Suspense.
The lessons start with what server-side rendering and hydration actually do: the server sends HTML, and React attaches event handlers to it in the browser. They then cover hydration mismatch errors, one of the most common production bugs in SSR apps, how React Server Components change what runs where, and streaming with Suspense, which lets the browser show and hydrate each part of the page as soon as it arrives.
These topics come up in senior frontend interviews and in any Next.js role, where you are expected to explain why a component must be a client component, what can cross the server boundary, and how to debug a page that renders differently on the server and the client.
React Server Components & SSR Interview Questions: 4 lessons
Server-Side Rendering (SSR) & Client Hydration
SSR and hydration in React: render the component tree to HTML on the server for a fast first paint, then hydrate it into an interactive app on the client. Client hydration walks the existing server-rendered DOM tree, creates internal Fiber nodes, and attaches synthetic event listeners without recreating DOM elements.
Hydration Mismatch Errors: Diagnosis & Solutions
Hydration mismatch occurs when server-rendered HTML differs from the initial client render tree, often caused by browser APIs, dates, or invalid HTML nesting. React 19 improves mismatch diff logging, but fixes include two-pass useEffect rendering or suppressHydrationWarning for unfixable text divergence.
React Server Components (RSC): Server vs Client
React Server Components (RSC) execute exclusively on the server with zero client JavaScript bundle cost and direct database access. Client Components ("use client") provide interactivity. The server streams a serialized JSON-like virtual DOM payload that integrates into the client tree.
Streaming SSR with Suspense & Selective Hydration
React 18 Streaming SSR uses renderToPipeableStream and Suspense boundaries to break HTML generation into streams, flushing shells immediately while slow queries stream in later. Selective Hydration begins hydrating ready components before all HTML or scripts finish downloading.
Frequently asked questions
What causes a hydration mismatch in React?
The HTML React renders in the browser differs from the HTML the server sent: values that differ between the two, such as Date.now() or Math.random(), reading window or localStorage during render, or invalid nesting such as a div inside a p. React then throws away the server HTML for that part and renders it again on the client.
What is the difference between SSR and React Server Components?
SSR renders client components to HTML on the server and then hydrates them, so their code still ships to the browser. Server Components run only on the server and send their output, not their code, to the client, so they add nothing to the JavaScript bundle and can read data directly.
What is selective hydration?
With streaming SSR and Suspense, React hydrates each Suspense boundary on its own as its HTML and code arrive, and it hydrates the part the user is interacting with first, so the page becomes interactive piece by piece instead of all at once.
