Course contentsShow
← React
Lesson 1537 of 2,39638. Server Components FundamentalsFree lesson

The Module Boundary, Not Component Boundary

The directive applies to the entire file and all its imports, creating a graph split point for bundling.

The Module Boundary, Not Component Boundary

What you'll learn: How the 'use client' directive affects entire files and their import chains, not just individual components.

The Key Misunderstanding

Many developers think 'use client' marks a single component as "client-side." That's not quite right. The directive actually creates a module boundary — it splits your component graph at the file level, affecting everything that file imports.

How It Really Works

When you add 'use client' to a file:

  1. The entire file becomes a Client Component module
  2. Everything that file imports also becomes client code
  3. All components exported from that file are Client Components
  4. This creates a graph split point for the bundler

Think of it like a firewall in a building. The directive doesn't seal off one room (component) — it seals off an entire wing (module) and everything connected to it.

// components/InteractiveForm.jsx
'use client'

import { analytics } from './analytics' // ← Now client-side too!
import { Button } from './Button'       // ← Now client-side too!

export function InteractiveForm() { /* ... */ }
export function FormHeader() { /* ... */ }  // ← Also client!

Both InteractiveForm and FormHeader are Client Components, even though only one might need interactivity. The analytics and Button modules also get pulled into the client bundle.

The Bundling Impact

Your bundler (Webpack, Turbopack, etc.) sees 'use client' as a split point. It stops following imports into server territory and creates a separate client bundle starting from this boundary.

Key Takeaway: 'use client' defines where the server/client split happens in your import graph, not which individual components run where. Place it strategically to minimize what crosses into client bundles.