React · Frontend system thinking
What are React Server Components and how do they differ from SSR?
Short answer
Server Components render only on the server and send a serialized UI description to the client, adding no component JavaScript to the bundle. SSR renders the same client components to HTML first; it is a different concern.
A Server Component runs on the server and can read data directly, including with await. Its code never ships to the browser. A Client Component is marked with 'use client' and can use state, effects and browser APIs. The two can be composed: a Server Component can render a Client Component, and a Client Component can receive Server Component output through children.
async function ProductPage({ id }) {
const product = await db.product.findUnique({ where: { id } });
return (
<main>
<h1>{product.name}</h1>
<AddToCartButton productId={product.id} />
</main>
);
}
// AddToCartButton.tsx
"use client";
export function AddToCartButton({ productId }) {
const [pending, startTransition] = useTransition();
return <button onClick={() => addItem(productId)}>Add to cart</button>;
}Server Components versus SSR
- RSC: component code stays on the server and is not hydrated on the client
- SSR: client component code is rendered to HTML, then hydrated in the browser
- RSC can be async and access server-only resources directly
- SSR improves first paint and SEO but still ships the component JavaScript
- A framework that supports RSC is required; it is not a drop-in Vite setting
Props crossing from server to client must be serializable. You cannot pass a function, a database client or a non-serializable class instance. Client Components cannot import Server Components directly; composition happens through props and children.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1Can a Server Component use useState?
- 2How does a Client Component import a Server Component?
- 3What data can be passed across the server-client boundary?
- 4Why does RSC reduce the client bundle?
Say it in the interview
Server Components run only on the server and send a serialized description of their UI to the client, so their code does not ship or hydrate. Client Components are marked with use client and handle state, effects and browser APIs. SSR is different: it renders client components to HTML for the first paint and then hydrates them. RSC needs framework support, and props crossing the boundary must be serializable.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live React mock interview and get scored feedback on depth, clarity and confidence.