Skip to the solution
HardFrontend5 min read

What are React Server Components and why does Next.js use them?

1.1k views

The problem

Question presented to candidate: "Explain React Server Components to me as if I only know classic SSR. What is actually sent to the browser, and why did Next.js make them the default?"

What a strong answer should cover:

  • A Server Component runs only on the server; its code and its dependencies are never sent to the browser.
  • The server sends the RSC payload: a serialized description of the rendered tree, with references to Client Component code where needed.
  • This is different from classic SSR, where the same component code also ships and runs again in the browser.
  • Benefits: smaller bundles, direct access to databases and secrets, data fetching close to the source, and streaming.
  • Limits: no state, effects or event handlers; interactivity lives in Client Components.

Clarifying questions expected:

  • "Is SSR the same thing?" β€” no; SSR produces HTML, RSC produces a payload, and Next.js uses both.
  • "Which parts need interactivity?" β€” those become Client Components; everything else can stay on the server.

Code / implementation expected: Yes β€” a server component that reads data, and what arrives in the browser.

  • nextjs
  • rsc
  • server-components
  • performance

Try it yourself

Sketch your approach before you read the solution. That is what the interview tests.

Stuck? Get a hint.

A short nudge toward the approach. It will not give the answer away.

Solution

The solution is hidden so you can try first

5 min read Β· 8 sections

Read the code

A Server Component that reads data directly
// app/orders/page.tsx  (Server Component: no directive, never sent to the browser)
import "server-only";
import { db } from "@/lib/db";
import OrderFilter from "./OrderFilter"; // a Client Component

export default async function OrdersPage() {
  const orders = await db.order.findMany({ take: 20 }); // runs on the server only
  return (
    <main>
      <h1>Recent orders</h1>
      <OrderFilter statuses={["open", "shipped"]} />
      <ul>
        {orders.map((o) => (
          <li key={o.id}>{o.number}: {o.total}</li>
        ))}
      </ul>
    </main>
  );
}

Discussion

Other approaches, follow-ups and how it went in real interviews.

Sign in to join the discussion.

No comments yet. Share how you would answer it.

Question 100 of 129 in Next.js

Keep your momentum going.

Mark this question solved to track your progress, then take the next one while it is fresh.

All Next.js questions
Up nextHard

Observability with OpenTelemetry in Next 15 β€” how is OTEL wired?

Continue