Skip to content
Live

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.

By Soren Lindqvist8 min read

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

FeatureServerClient
Runs onServer onlyBrowser
Can use hooksNoYes
Can access DBYesNo
Bundle sizeZeroIncluded
InteractivityNoYes

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.

Share

Written by

Soren Lindqvist

Engineer. Ships the TypeScript, Docker, and database pieces, usually after breaking them in production first.

nextjs

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.

Soren Lindqvist11 min read
react

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.

Soren Lindqvist9 min read
performance

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.

Amara Osei11 min read