React Server Components (RSC)
A React architecture that executes components exclusively on the server, eliminating their dependencies from the client bundle and streaming UI payloads
Table of Contents
Structure Diagram
What is React Server Components (RSC)?
A React architecture that executes components exclusively on the server, eliminating their dependencies from the client bundle and streaming UI payloads. It is a core concept in Rendering & Frontend within Web Dev.
Core Principles
React Server Components (RSC) differ fundamentally from traditional SSR. Classic SSR still ships every component's JavaScript to the browser for hydration. RSC introduces components that execute exclusively on the server and contribute zero bytes to the client JavaScript bundle.
Server Components can await database queries, read files, and run heavy libraries (such as Markdown parsers or syntax highlighters) on the server, streaming only the serialized UI tree (RSC Payload) to the browser. Interactive leaves that require useState or DOM events opt in via the 'use client' directive.
Practical Takeaways
- Push
'use client'boundaries down to the leaves: Marking a high-level layout as a client component pulls its entire import graph into the browser bundle. Wrap only the interactive widgets (buttons, filters, forms) in client components and pass server-renderedchildrenthrough them. - Respect serialization rules: Props passed across the server-to-client boundary must be serializable (no class instances or raw callbacks; use Server Actions for mutations).
- Avoid server waterfalls: Parallelize independent queries with
Promise.alland wrap slow subtrees in<Suspense>for streaming.
Notable Examples
- Next.js App Router storefronts & docs: Move MDX rendering, authorization checks, and database reads into Server Components, cutting shipped client JS dramatically.
- Internal admin dashboards: Access private microservices and secrets safely on the server without building extra BFF REST endpoints.