WhoBuilt

React Server Components

Dec 31, 2020· 9 min· 36K views·Watch on YouTube

Lee Robinson, a developer at Vercel, explains React Server Components and demonstrates how they work with Next.js and Vercel.

Why hybrid apps matter

Choosing only client rendering, server rendering, or static generation can limit an application. Server Components let developers choose what runs on the server or client for each component, keeping heavy dependencies such as Markdown and date libraries off the client.

How Server Components differ from SSR

Server-side rendering sends HTML to speed up the initial display, but the browser still downloads and runs the client components. Server Components instead return a description of the rendered UI that React can merge with existing client components, allowing updates without losing client state.

Suspense and concurrent rendering

Suspense can show a loading fallback while code or data loads and help avoid sequential network requests. The talk also describes Concurrent Mode as allowing components to render as data streams in and supporting multiple state updates.

Hosting and the Next.js demo

Server Components require Node.js, so teams need a server or serverless hosting provider. In the note-taking demo, selecting a note triggers a request whose response updates the server-rendered detail while preserving client state such as the search text. The project was open source, and Server Components were still experimental.

Takeaways

  • Use Server Components to keep heavy formatting or data dependencies out of the client bundle.
  • Treat Server Components as complementary to server-side rendering: SSR sends HTML, while Server Components describe UI updates for React.
  • Choose server or client rendering per component when different parts of an app have different needs.
  • Account for server or serverless hosting when adopting Server Components.
  • Use Suspense fallbacks and parallel data requests to keep the interface responsive while content loads.

Mentioned in this talk

Search inside this talk

What was claimed 8

Related talks

React Server Components · WhoBuilt