React Server Components: components that never ship to the browser
Server vs client components, what "use client" really marks, which props can cross the boundary, the RSC payload, zero client JavaScript for server components, data fetching on the server, composition with children, and why RSC is not SSR.
Comes up in: React, Frontend system design
Learn#
Siddharth’s product page ships 180 KB of JavaScript, mostly a markdown parser and a date library used to show text that never changes. Every phone downloads and runs that code just to display static content.
A Server Component runs only on the server, or at build time. It can read databases and files directly, and its code is never sent to the browser; only its rendered output is. A Client Component also runs in the browser, so it can use state, effects and event handlers.
In frameworks that support RSC, components are server components by default. The “use client” directive at the top of a file marks the boundary: that file and what it imports become client code.
// ProductPage.jsx (Server Component: no directive)
import { db } from "./db";
import { AddToCart } from "./AddToCart";
export default async function ProductPage({ id }) {
const product = await db.product.find(id); // runs on the server only
return (
<main>
<h1>{product.name}</h1>
<Markdown>{product.description}</Markdown>
<AddToCart productId={product.id} price={product.price} />
</main>
);
}The server sends an RSC payload: the server components’ output plus references to client components and their props.
State
- server: ProductPage, db.query(…)
Network
empty
Page
empty
ProductPage is a Server Component. It reads the product straight from the database on the server; the code and the DB client never reach the browser.
Read the steps as text
- ProductPage is a Server Component. It reads the product straight from the database on the server; the code and the DB client never reach the browser.
- It renders <AddToCart productId={42} price={499} />. AddToCart's file starts with "use client", so here the server stops and leaves a reference to the client component.
- The server sends the RSC payload: the rendered server output plus client component references and their props.
- The browser downloads only AddToCart's JavaScript, renders it with those props, and makes it interactive. Description and specs ship as output, not code.
Predict#
Predict first
A Server Component passes onClick={() => track('buy')} to a Client Component button. What happens?
Props crossing the boundary must be serializable. A normal function cannot be sent to the browser. Define the handler inside the client component, or pass a Server Function marked with "use server" (RCT.06.04). People expect props to work the same everywhere.
Interview angle#
Say it like this — about 30 seconds
“Server Components run only on the server and send rendered output, not code, so libraries they use add no client JavaScript, and they can fetch data directly. Client Components, marked with use client, run in the browser and can use state and effects. Props crossing from server to client must be serializable: primitives, plain objects, arrays, dates, promises and Server Functions, but not ordinary functions or class instances. RSC is not SSR: SSR turns components into HTML; RSC decides which components run where, and works with SSR.”
Follow-up What is the difference between SSR and React Server Components?
Follow-up What can and cannot be passed from a server component to a client component?
Follow-up Can a client component import a server component?
Practice#
On your own
Write the check frameworks run on props that cross the server-to-client boundary.
Done when
- Serializable values pass, including nested arrays, Dates, Maps, Sets and promises.
- The first plain function, class instance or symbol is reported with its path and reason.
- Server Functions are allowed.
Remember#
Try to answer each card before you open it. Then add them to your reviews.
Where does a Server Component's code run?
Only on the server (or at build time); it never ships to the browser.
What does "use client" mark?
The boundary where a file and its imports become client code.
Can a Server Component pass an onClick function to a Client Component?
No, unless it is a Server Function; plain functions are not serializable.
How can a client component render a server component?
Receive it as children or another JSX prop from a server component.
Go deeper
Four layers. Stop at the one your interview needs; each ends with a quick check.
The core ideaEvery round
async and await data directly, without effects or loading states in the browser. They cannot use state, effects or browser APIs.Check yourself: Can a Server Component use useState?
No. State and effects need the browser, so they belong in client components.
How it works underneathSenior rounds
The payload is a streamed description of the tree. Where a client component appears, it holds a reference to its module and export plus its serialized props; the browser loads that module and renders it Source: React: Server Components.
Check yourself: What does a client component reference in the RSC payload contain?
Which module and export to load, plus its serialized props.
Edge cases and trapsWhere people slip
children: <ClientTabs><ServerPanel /></ClientTabs>. The server renders the panel; the client places it.Check yourself: Is the use client directive needed on every client file?
No. Only at the entry file of the boundary; its imports are client code too.
In productionStaff-level answers
Check yourself: Do RSC and SSR compete?
No. They work together: RSC splits the work, SSR produces first-load HTML.
Finished the five steps? Mark it, and its cards join your reviews.
Last checked 2026-11-01. Spot a mistake? Use “Report an error” below — fixes are listed on the corrections page.
Interview questions this answers
- What is the difference between SSR and React Server Components?
- What can and cannot be passed from a server component to a client component?
- Can a client component import a server component?