React Server Components Explained
Everything you need to know about React Server Components — what they are, how they differ from client components, and when to use each.
The Mental Model Shift
React Server Components (RSC) represent the biggest architectural change to React since hooks. The core idea: some components run only on the server, others only on the client, and the framework handles the boundary.
Server vs Client Components
| Feature | Server | Client |
|---|---|---|
| Runs on | Server only | Browser |
| Can use hooks | No | Yes |
| Can access DB | Yes | No |
| Bundle size | Zero | Included |
| Interactivity | No | Yes |
Default is Server
In Next.js App Router, every component is a Server Component by default:
// This runs on the server — no "use client" needed
async function BlogPost({ slug }: { slug: string }) {
const post = await db.posts.findOne({ slug }); // Direct DB access!
return <article>{post.content}</article>;
}
Opting Into Client
Add "use client" only when you need browser APIs or interactivity:
"use client";
import { useState } from "react";
export function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
}
The Composition Pattern
The key insight: Server Components can render Client Components, but not vice versa.
// Server Component
async function Page() {
const data = await fetchData();
return (
<div>
<StaticContent data={data} /> {/* Server */}
<InteractiveWidget /> {/* Client */}
</div>
);
}
When to Use Each
Use Server Components for: data fetching, database queries, large dependencies, static content.
Use Client Components for: event handlers, browser APIs, useState/useEffect, real-time updates.
The result is dramatically smaller JavaScript bundles and faster initial page loads.
Written by
Soren Lindqvist
Engineer. Ships the TypeScript, Docker, and database pieces, usually after breaking them in production first.
Related Articles
Next.js App Router: Patterns That Actually Work
Real-world patterns for the Next.js App Router — parallel routes, intercepting routes, loading UI, error boundaries, and streaming with Suspense.
State Management in 2024: What Actually Works
Redux is no longer the default answer. Compare Zustand, Jotai, TanStack Query, and React's built-in tools to find the right solution for your app.
Web Performance: Beyond Core Web Vitals
Core Web Vitals are just the start. Learn advanced performance techniques including resource hints, code splitting, and the new INP metric.