Decision Flowchart: Server vs Client
You'll learn a simple mental checklist to decide whether each component should be Server or Client.
The Default Rule
Start with Server Components always. Every new component you create is a Server Component by default in the App Router. Only add 'use client' when you hit a clear need.
The Three Questions
Ask yourself these questions in order:
-
Does this component use state, effects, or event handlers?
- Yes → Add
'use client'(at this component or higher) - No → Continue to question 2
- Yes → Add
-
Does this component access browser APIs like
window,localStorage, ornavigator?- Yes → Add
'use client' - No → Continue to question 3
- Yes → Add
-
Does this component render a Context provider?
- Yes → Add
'use client' - No → Keep it as a Server Component
- Yes → Add
Add 'use client' at the First Component That Needs It
Don't mark the entire page or layout as Client just because one button needs onClick. Instead, push the 'use client' directive down to the first component that needs interactivity. Everything above it stays Server.
For example: If a page fetches data and renders a list with one interactive button, only the button component (or a wrapper around it) needs 'use client'. The page and list components remain Server.
The Visual Check
If you can imagine the component rendering to static HTML without JavaScript, it's a Server Component. The moment you need JavaScript to make it do something, that's your Client boundary.
Key Takeaway: Server is the default; only add 'use client' at the first component that uses state, effects, browser APIs, or Context providers—keep everything else Server.