Software Studio
Back to Articles

React Server Components: What Actually Changed

ReactNext.jsTypeScript
Cover illustration for React Server Components: What Actually Changed

React Server Components represent the biggest shift in React's mental model since hooks. After a year of building with them in production, here's what I wish someone had told me at the start.

The core concept

The core concept is simple: some components run only on the server. They can access databases, read files and call APIs directly. No useEffect, no loading states, no API routes.

The HTML they produce is streamed to the client. They never ship JavaScript to the browser.

The default flipped

The mental model shift is significant. In the old world, every component was a client component. Data fetching happened in useEffect or getServerSideProps.

Now, the default is server. You opt into client behavior with 'use client' when you need interactivity:

  • Event handlers
  • State
  • Effects
  • Browser APIs

The server-client boundary

The boundary between server and client components is where most confusion lives. There are three rules.

  1. A server component can render a client component.
  2. A client component cannot import a server component.
  3. You can pass server component output as children to a client component.

The third rule is the one that makes the first two workable. A client component, such as a collapsible panel, can wrap content that was rendered on the server:

// Server component
export default async function Page() {
  return (
    <Collapsible title="Recent orders">
      <OrderList />
    </Collapsible>
  );
}

Here Collapsible is a client component that manages open and closed state. OrderList is a server component that queries the database. The panel never imports the list. It just receives it. This constraint shapes your component architecture.

Data fetching got dramatically simpler

A server component that needs data just awaits a database query at the top of the function.

export default async function OrdersPage() {
  const orders = await getRecentOrders();

  return (
    <ul>
      {orders.map((order) => (
        <li key={order.id}>{order.reference}</li>
      ))}
    </ul>
  );
}

No useEffect. No loading state management. No stale data bugs. The component renders with the data it needs. For most pages, this eliminates an entire category of complexity. I show how this pairs with an ORM in Prisma Patterns for Next.js Applications.

Performance: real but nuanced

The performance benefits are real but nuanced.

The gain: server components reduce JavaScript bundle size. Components that don't need interactivity send zero JS. A page that is mostly content ships very little code.

The cost: the initial page load still requires a server round-trip. The server has to do its work before the browser has anything to show.

For highly dynamic pages, the streaming model with Suspense boundaries provides a progressive loading experience that feels fast. The page shell arrives immediately and slower sections fill in as their data is ready.

<Suspense fallback={<OrdersSkeleton />}>
  <OrderList />
</Suspense>

The common mistake: too much 'use client'

Where I've seen teams struggle: over-extracting client components. The temptation is to add 'use client' the moment you need an onClick handler. Because everything imported by a client component is also bundled for the client, one directive near the top of the tree can turn most of a page into client code.

Instead, push the client boundary as deep as possible. A page-level server component can render most of the UI, with a small interactive widget as a client component leaf. If a product page needs an "Add to cart" button, the button is the client component. The page around it stays on the server.

Forms are the killer use case

Server Actions let you handle form submissions without API routes. The form component is a server component. The action function runs on the server.

async function subscribe(formData: FormData) {
  "use server";

  const email = String(formData.get("email"));
  await saveSubscriber(email);
  redirect("/thanks");
}

export default function SubscribeForm() {
  return (
    <form action={subscribe}>
      <input type="email" name="email" required />
      <button type="submit">Subscribe</button>
    </form>
  );
}

Validation, database writes and redirects happen in one place. This pattern eliminates an enormous amount of boilerplate.

One caution: an action is reachable by anyone who can send a request to your site. Validate its input and check permissions inside the action, exactly as you would in an API route.

How to think about it

My advice: stop thinking in terms of "server components vs client components" and start thinking about "where does this code need to run?"

  • If it needs the DOM or user interaction, it's client.
  • Everything else is server by default.

Once that question becomes a habit, the rules stop feeling like restrictions. They describe a split that was always there. React now lets you say it out loud.