use client vs use server in Next.js: The Real Difference
Technology

use client vs use server in Next.js: The Real Difference

The #1 misconception in the App Router: "use server" is not the opposite of "use client". One marks a client boundary in the module graph; the other exposes callable server functions. Server Components are the default — no directive needed.

2026-06-18
8 min read
use client vs use server in Next.js: The Real Difference

If you think "use client" and "use server" are opposites — one for client components, one for server components — you have the single most common App Router misconception. They are not symmetric. This guide nails down what each actually does, straight from the React and Next.js docs.

Server Components are the default#

In the App Router, "by default, layouts and pages are Server Components." An unmarked file in app/ is already a Server Component — there is no directive to "make" one. Keep this in mind; it's why "use server" can't be the way to create one.

What "use client" does#

"use client" marks the boundary in the module dependency tree where code switches from server to client. From the React docs: it marks "the module and its transitive dependencies as client code" and defines the boundary "on the module dependency tree, not the render tree."

tsx
// app/ui/counter.tsx
'use client'
import { useState } from 'react'
 
export default function Counter() {
  const [count, setCount] = useState(0)
  return <button onClick={() => setCount(count + 1)}>{count}</button>
}

The crucial nuance most people miss: the boundary follows imports, not props. A Server Component passed as children to a Client Component stays a Server Component — it's rendered on the server and passed in as output. Only imported descendants get pulled client-side.

The directive must be at the very top of the file, above imports (comments are fine), with single or double quotes — not backticks.

What "use server" does (the misconception)#

"use server" marks Server Functions (a.k.a. Server Actions) — async functions that run on the server but are callable from client code. The React docs: it "marks server-side functions that can be called from client-side code." It does not make a component a Server Component.

tsx
// app/actions.ts
'use server'
import { db } from '@/lib/db'
 
export async function fetchUsers() {
  return db.user.findMany()   // runs on the server, callable from the client
}
tsx
// app/components/users-button.tsx
'use client'
import { fetchUsers } from '../actions'
 
export default function UsersButton() {
  return <button onClick={() => fetchUsers()}>Load users</button>
}

It has two legal placements: at the top of a file (marks all exports as Server Functions) or inline at the top of an async function body (marks just that function). It cannot go on a non-async function.

The contrast, side by side#

| | "use client" | "use server" | |---|---|---| | Goes | Top of a file, above imports | Top of a file, or inline in an async function | | Marks | A boundary: this module + imports become client code | Server Functions callable from the client | | Acts on | The module import graph | Individual server functions | | Common mistake | Placed too high → whole subtree ships to client | Used hoping to "force a Server Component" |

The two classic mistakes#

Don't
'use server' at the top of a component file, expecting it to become a Server Component.
Do
No directive at all — components in app/ are Server Components by default. Use 'use server' only for callable server functions.
Don't
'use client' on a layout so one small widget can use useState — now the entire subtree is in the client bundle.
Do
'use client' on the leaf <Counter/> only; keep the layout a Server Component and pass server content via children.

The Next.js docs spell out the second fix: "add 'use client' to specific interactive components instead of marking large parts of your UI as Client Components."

Terminology drift

"Server Actions" was the original name; React/Next now use "Server Functions" as the umbrella term, with "Server Actions" meaning ones wired to forms / action props. If you're searching docs, both terms point at the same "use server" feature.

When this won't work
  • This is App Router only — the Pages Router has neither directive nor Server Components.
  • Some bundlers strip "use client" when building component libraries; library authors need bundler config to preserve it.
  • Both directives are an RSC-era (React 19) feature — they don't apply to a classic React 18 SPA.

Official references: React use client, React use server, Next.js Server and Client Components.

Frequently Asked Questions#

Does "use server" make a component a Server Component?#

No. It marks server functions callable from the client. Server Components are the default in the App Router and need no directive — adding "use server" to a component file does not create one.

What does "use client" actually do?#

It marks the module and its transitive imports as client code — a boundary on the module dependency tree. It does not apply to Server Components passed in as children; those stay server-rendered.

Where do I put "use client" to avoid bloating the bundle?#

On the smallest interactive leaf component, not a layout or page. High placement pulls the whole imported subtree into the client bundle.

Frequently Asked Questions

|

Have more questions? Contact us

Written by

Mahdi Br
Mahdi Br

Full-Stack Dev — Next.js & Supabase

Solo developer building SaaS products with Next.js and Supabase. Writing about production patterns the official docs skip.

Remote

One email a month — no fluff

RLS gotchas, Next.js cache debugging, and the one Supabase setting that bit me last month.