Courses / React 19: From Components to Production / Chapter 15
Module 7 · Suspense, Streaming and Server Components · Chapter 15 of 30
Server Components: The Client Boundary, Server Functions and Caching
Builds on Suspense, Streaming SSR and Code-Splitting and New in React 19: Actions, use, Optimistic UI and ref as a Prop. Next up: Server State with TanStack Query.
Part 1 · What Server Components are
Components that run before the browser
A coaching institute lists its courses with fees and seats, and each card has one button that reacts to a click. Server Components let the list render on the server and ship only that button to the browser.
A Server Component is a component that runs ahead of time, in an environment separate from the client app. The react.dev reference says it can run once at build time or once per request on a web server. What reaches the browser is its rendered output, not its code. A Server Component can be async, can read a database or the file system directly, and cannot use state, effects or event handlers, because there is no browser for them to run in.
It is not the same thing as server-side rendering. Server-side rendering, from the previous chapter, takes the whole tree and produces HTML for the first paint, after which every component also runs in the browser to hydrate. Server Components decide which components ever run in the browser at all. A framework can combine both: it renders Server Components, renders the client parts to HTML, and sends the result. The reference is explicit about one common mistake. There is no directive for Server Components: a component is one by default, and the directive "use client" marks the exceptions. "use server" means something else, and the fifth lesson covers it.