Skip to content
Back to Pathway
patternsexpert

Server Components

React Server Components (RSC) execute exclusively on the server, streaming zero client JavaScript bundle size to the browser.

Mental Model

"The Remote Cloud Kitchen: Meals are cooked and assembled in a centralized industrial kitchen, delivering ready-to-eat hot dishes straight to your door."

Interactive Engine Walkthrough

Walkthrough Idle
Click "Animate Update" to play the state reconciliation walkthrough.

Reference Code Snippet

Component.jsx
JSX / React 19
1// app/page.js (Server Component)
2async function Page() {
3  // Direct DB access! 
4  // No 'useEffect' needed.
5  const posts = await db.posts.findMany();
6
7  return (
8    <ul>
9      {posts.map(p => <li key={p.id}>{p.title}</li>)}
10    </ul>
11  );
12}
Technical Takeaways & Best Practices
  • 01.Server Components have direct access to backend resources (databases, file systems, internal microservices).
  • 02.Their code and heavy dependencies (markdown parsers, date formatters) never download to the client browser.
  • 03.Client components are imported at the interactive leaf nodes using the "use client" directive.

01. Zero-Bundle Size

React Server Components (RSC) are a new type of component that only runs on the server. Because they never reach the browser, their dependencies (like heavy Markdown or Date libraries) contribute **zero** to your client-side bundle size.

Execution Split

Server (Logic)
→ (JSON) →
Client (Interactivity)

02. Server-side Logic

Server components can be `async` and can perform database queries or file system operations directly. This eliminates the "Fetch-Waterfalls" of traditional client-side apps where you fetch data in a nested chain of effects.

Architectural Advice

"Think of Server Components as the **Skeleton** of your app and Client Components as the **Muscles**. Use Server Components for layout, data fetching, and static content. Use Client Components only for state, effects, and event listeners."