Module F-3·24 min read

The network boundary in plain terms, what "use client" actually costs, why Server Components are the default, and the five mistakes every engineer makes the first week.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer

F-3 — Server Components vs Client Components: First Contact

Who this is for: Developers who have the App Router file system model from F-2 but haven't internalised the Server Component mental model yet. This module is the biggest conceptual leap in the entire course. Take it slowly. The confusion most engineers feel with the App Router traces back to skimming or misunderstanding this module.


The Shift That Changes Everything

React has always been a client-side library. You import it, it runs in the browser, it manages the DOM. Every mental model you built around hooks, effects, event handlers, browser APIs — all of it was built around the assumption that your components run in the browser.

React Server Components break that assumption at the root.

Starting with Next.js 13 App Router and React 18, a component can now be an async function that runs on the server, fetches data directly from a database or API, renders HTML, and sends the result to the browser — without ever shipping a single byte of its code to the client.

This is not "SSR." Server-Side Rendering has existed since the early days of Next.js — the Pages Router did SSR via getServerSideProps. The difference is architectural:

  • Old SSR model: The entire page runs on the server (page-level function → props → component tree renders). The component code also ships to the browser and runs again during hydration.
  • RSC model: Individual components can be server-only. Their code never reaches the browser. They don't hydrate. They exist as rendered output only.

This distinction is why React Server Components are a genuine paradigm shift rather than a performance tweak.


Two Worlds, One Tree

In the App Router, your component tree is split across a boundary. On one side: Server Components. On the other: Client Components. Both render React, but they have different rules, different capabilities, and different costs.

Server Components:

  • Run on the server at request time (or build time for static pages)
  • Can be async — can await database queries, API calls, file reads
  • Cannot use hooks (useState, useEffect, useRef, etc.)
  • Cannot attach event handlers (onClick, onChange, etc.)
  • Cannot access browser APIs (window, document, localStorage)
  • Zero JavaScript sent to the browser — they don't hydrate

Client Components:

  • Run in the browser (and also on the server during SSR for the initial HTML)
  • Can use hooks — useState, useEffect, useRef, useContext, all of them
  • Can attach event handlers
  • Can access browser APIs
  • Their code ships to the JavaScript bundle — they hydrate in the browser

The key insight: Server Components are the default. When you create a file in the App Router and don't add any directive, it's a Server Component. You opt into the client side explicitly.


The 'use client' Directive

Adding 'use client' at the top of a file marks it as a Client Component. This creates a boundary — a point where the server-rendered tree hands off to the client-rendered tree.

tsx
tsx

The 'use client' directive does not mean "this only runs in the browser." It means "this is a Client Component." React will still server-render it for the initial HTML — your button will appear in the HTML document before JavaScript loads. But it will also hydrate in the browser, and its code will be in the JavaScript bundle.


The Boundary Rule: Client Components Cannot Import Server Components

This is the rule that catches every engineer off guard at least once:

A Client Component cannot import a Server Component.

If you do this:

tsx

The ServerComponent would be pulled into the client bundle — it would run in the browser just like any other imported module. The "server-only" contract is violated.

But you can pass Server Components as props to Client Components:

tsx
tsx

Sign in to keep reading

The rest of this module is free — sign in with Google to unlock it and track your progress.

Sign in & Register

Discussion

0

Join the discussion

Loading comments...

© 2026 Jatin Jain Saraf (JJS). All rights reserved.