>_Blogging Programmer~/notes since 2016
blogging-programmer › react › react-server-components-without-the-hype.md
date: 2026-12-01 topics: [React] read: 4 min words: 876

React: Server Components Without the Hype

Few React features have produced as many strong opinions as Server Components. Some articles describe them as the biggest change since hooks. Others say they turned a simple UI library into a confusing framework.

I have written about React on this blog since 2017, and I have used Server Components through Next.js long enough to form a calmer view. They are a useful tool for a specific set of problems. They are not a replacement for everything that came before.

What a Server Component Is

A Server Component is a React component that runs only on the server. Its code is never sent to the browser. It can be async, read from a database or the file system directly, and return JSX that React sends to the client as a serialized description of the UI.

// app/posts/page.tsx — a Server Component by default in the Next.js App Router
import { db } from '@/lib/db';

export default async function PostsPage() {
  const posts = await db.post.findMany({ orderBy: { date: 'desc' }, take: 20 });

  return (
    <ul>
      {posts.map((post) => (
        <li key={post.id}>{post.title}</li>
      ))}
    </ul>
  );
}

There is no useEffect, no loading state for the initial data, no API endpoint written only to feed this page, and the database client never reaches the browser bundle.

What a Client Component Is

A Client Component is the React component we have always written. It runs on the server for the initial HTML, then again in the browser, where it can use state, effects and event handlers. In frameworks that support Server Components, a file opts into this with a directive:

'use client';

import { useState } from 'react';

export function LikeButton({ initialLikes }: { initialLikes: number }) {
  const [likes, setLikes] = useState(initialLikes);
  return <button onClick={() => setLikes(likes + 1)}>♥ {likes}</button>;
}

The important thing to understand is that 'use client' marks a boundary. Everything this file imports also becomes part of the client bundle.

How They Fit Together

A Server Component can render a Client Component and pass it serializable props:

// Server Component
import { LikeButton } from './like-button';

export default async function PostPage({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params;
  const post = await getPost(slug);
  return (
    <article>
      <h1>{post.title}</h1>
      <div dangerouslySetInnerHTML={{ __html: post.html }} />
      <LikeButton initialLikes={post.likes} />
    </article>
  );
}

The article text is rendered on the server and costs nothing in JavaScript. Only the button ships code.

The reverse direction has a rule that confused me at first: a Client Component cannot import a Server Component. It can, however, receive one as children or another prop, because by then the server has already rendered it:

'use client';
export function Collapsible({ children }: { children: React.ReactNode }) {
  const [open, setOpen] = useState(false);
  return (
    <section>
      <button onClick={() => setOpen(!open)}>{open ? 'Hide' : 'Show'}</button>
      {open && children}
    </section>
  );
}
// Server Component
<Collapsible>
  <ExpensiveServerRenderedList />
</Collapsible>

Where Server Components Shine

Pages that mostly display data. Blogs, documentation, product pages, dashboards that are read more than edited. The data fetching moves next to the component that needs it, and the JavaScript sent to the browser shrinks.

Heavy dependencies that only format content. Markdown parsers, syntax highlighters and date libraries can run on the server and never reach the bundle. This is the same reason my own blog renders code highlighting at build time.

Keeping secrets on the server. Database credentials and API keys stay in server code by construction. Libraries such as server-only can make an accidental import into a Client Component fail the build.

Avoiding request waterfalls. Fetching on the server, close to the database, is usually faster than a browser making a chain of requests after the JavaScript has loaded.

Where They Get in the Way

Highly interactive screens. A drag-and-drop editor, a complex form or a spreadsheet-like grid is almost entirely client state. Wrapping it in Server Components adds boundaries without benefits. Most of that screen will be 'use client', and that is fine.

The mental model of two environments. Every file now has an implicit question: where does this run? Errors like “You’re importing a component that needs useState” are a normal part of the learning curve. On a team, this needs agreed conventions, such as keeping Client Components in clearly named files.

Serialization limits. Props passed from server to client must be serializable. Functions cannot be passed, except Server Actions. Class instances and Date objects need care depending on the framework version.

Caching complexity. In Next.js, Server Components come with a caching system that has changed several times. Much of the frustration I see online is about caching rather than Server Components themselves.

How I Decide

I start every component as a Server Component and add 'use client' only when I need one of these:

  • state (useState, useReducer),
  • effects or browser APIs,
  • event handlers,
  • a library that depends on any of the above.

When I do need client behaviour, I push the boundary as far down the tree as I can. The page stays on the server, and only the interactive leaf, such as a button, a search box or a chart, becomes a Client Component.

Do You Need Them at All?

No. A single-page application built with Vite and a REST API is still a perfectly good architecture, especially for internal tools behind a login, where search engines and first-load performance matter less.

Server Components require a framework that supports them, a server or build step that runs React, and a team willing to learn where the boundaries are. For content-heavy public sites, I think that trade is worth it. For an admin panel that is all forms and tables, I am not convinced it is.

Summary

  • Server Components run only on the server, can be async, and send no JavaScript of their own.
  • Client Components are the components we always had, marked with 'use client'.
  • Start on the server, and move to the client only for interactivity, as deep in the tree as possible.
  • They are a strong fit for content and data display, and a weak fit for highly interactive applications.

Without the hype, Server Components are simply another place to run a component. Knowing when to use that place is more useful than having an opinion about whether it should exist.

No comments yet #React Next.js
Ctrl J