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

Server Components Cannot Import Client Components Directly

Why direct imports violate the execution model and how the bundler enforces this constraint.

Server Components Cannot Import Client Components Directly

You'll learn why Server Components can't directly import Client Components and how React enforces this rule.

The Execution Model Problem

Remember: Server Components run once on the server, while Client Components need to run in the browser. When a Server Component tries to directly import a Client Component, you're asking the server to understand code that only makes sense in the browser — code with useState, event handlers, and access to window.

The bundler sees that import and thinks: "I need to bundle this Client Component's code into the server build." But that creates a contradiction: the server can't execute browser-only hooks, and the client needs that component's JavaScript sent separately.

How the Constraint Gets Enforced

When you write this in a Server Component:

// ❌ This won't work
import ClientButton from './ClientButton' // has 'use client'

export default function ServerPage() {
  return <ClientButton />
}

The bundler (and React) will throw an error. The import itself is the problem, not the JSX usage. You're trying to pull Client Component code into the Server Component module graph.

The Workaround You Already Know

You can pass Client Components as props (which you learned in the previous lesson). This works because you're not importing in the Server Component — another component higher up handles the import and passes the result down.

Key Takeaway: Server Components cannot import Client Components directly because it violates the execution model — server code can't bundle or execute client-only hooks and browser APIs. The bundler enforces this at build time.