The Boundary Strategy: Push 'use client' Down
You'll learn the core strategy for minimizing JavaScript: place 'use client' as low in your component tree as possible, not at the top.
The Strategy: Go Deep, Not Wide
The most common mistake developers make is placing 'use client' on high-level components like entire pages or layouts. This turns everything below into Client Components, shipping unnecessary JavaScript.
Instead, push the boundary down to the smallest possible component that actually needs interactivity. Keep parent components as Server Components and only wrap the interactive "leaf" components.
Visual Example
❌ BAD: 'use client' at the top
'use client'
<Page> ← Everything below is now client
<Header /> ← Static, but client now
<Content /> ← Static, but client now
<Button /> ← Needs interactivity
</Page>
✅ GOOD: 'use client' pushed down
<Page> ← Server Component
<Header /> ← Server Component
<Content /> ← Server Component
<InteractiveButton /> ← 'use client' only here
</Page>
The Analogy
Think of JavaScript like paint. You want to paint only the buttons and knobs that need to move, not the entire wall they're mounted on. Keep the wall (your page structure) as Server Components, and only paint the interactive pieces.
In Practice
Extract your interactive features into small, focused components. A page with one button doesn't need 'use client' on the page—just on the button component itself.
Key Takeaway: Place 'use client' on the smallest component that needs it. Keep everything else as Server Components to minimize your JavaScript bundle.