Understanding when to use React Server Components (RSC) and when to introduce the "use client" boundary is the single most important conceptual skill in modern Next.js engineering.
| Feature | Server Components (Default) | Client Components ("use client") |
|---|---|---|
| Execution Environment | Runs only on the server | Pre-rendered on server, hydrated in browser |
| Browser Bundle Impact | 0 KB (Dependencies stay on server) | Added to browser JavaScript bundle |
| Direct Backend Access | Full access to databases, filesystems, env secrets | No direct access to databases/secrets |
| React Hooks | ❌ No useState, useEffect, useReducer | ✅ Full access to state, lifecycle, and custom hooks |
| Browser APIs & Events | ❌ No onClick, onChange, window, localStorage | ✅ Full access to DOM events and browser APIs |
"use client" BoundaryAdding "use client" at the very top of a file declares a boundary between server-only code and code that needs client interactivity. It does NOT mean the component runs only on the client! It will still be pre-rendered to HTML on the server during initial load, then hydrated in the browser with event listeners.
"Push client components down to the leaves of your component tree."
Instead of marking your entire page with 'use client', keep your layout and pages as Server Components (fetching data and securing secrets), and only import small client components where interactivity is strictly required:
'use client' directive at the top of a file do?children prop into a Client Component?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.