Nextjs Fundamentals · Server & Client Components

Server Components by default

RSC and the RSC Payload

Server Components by default

In the App Router, every component is a Server Component unless you say otherwise. Server Components render on the server — ahead of time, or on each request — so they never ship their code to the browser.

That changes what they can do. A Server Component can be async and await data directly, read from a database, and use secrets, because none of it leaves the server:

// app/posts/page.tsx
export default async function Page() {
  const posts = await getPosts();
  return <PostList posts={posts} />;
}

A Server Component cannot use state, effects, event handlers, or browser APIs — those need the client.

When Next.js renders a route it produces two things: HTML for a fast, non-interactive first paint, and the RSC Payload — a compact description of the rendered tree. The payload holds the output of the Server Components plus placeholders for any Client Components and the props they receive. React uses both to reconcile the tree on the client. On a client-side navigation, Next.js sends only the RSC Payload, not a new HTML document.

Because Server Component code stays on the server, it does not add to the JavaScript bundle the browser downloads. That is the performance story: fetch close to the data, keep secrets server-side, and ship less code.

You are about to answer a short quiz on RSC and the RSC Payload.

  1. In the App Router, components are Server Components by default.
  2. A Server Component can use useState and useEffect.
  3. On the initial page load, the server sends HTML together with the ___, which React uses to reconcile the tree.
  4. A Server Component's code is included in the JavaScript bundle sent to the browser.
  5. Because Server Components run on the server, they can be ___ and fetch data directly.
  6. On a client-side navigation, Next.js sends only the RSC Payload, not a new HTML document.