Where to Place 'use client': Lowest Point Strategy
What you'll learn: How to maximize server-side rendering by pushing 'use client' as deep as possible into your component tree.
The Lowest Point Rule
Think of 'use client' like a waterline — everything above it stays on the server, everything below flows to the client. Your goal: keep that waterline as low as possible.
Instead of marking a parent component as client-side just because one child needs interactivity, push 'use client' down to only the component that actually needs JavaScript.
The Anti-Pattern
// ❌ Bad: Marking the whole page as client
'use client'
export default function ProductPage({ product }) {
return (
<div>
<ProductDetails data={product} /> {/* Could be server */}
<Reviews reviews={product.reviews} /> {/* Could be server */}
<LikeButton productId={product.id} /> {/* Needs client */}
</div>
)
}
This sends the entire page component to the client, along with all its children.
The Optimized Approach
// ✅ Good: Only the button is client-side
export default function ProductPage({ product }) {
return (
<div>
<ProductDetails data={product} />
<Reviews reviews={product.reviews} />
<LikeButton productId={product.id} />
</div>
)
}
// In LikeButton.jsx
'use client'
export function LikeButton({ productId }) {
const [liked, setLiked] = useState(false)
return <button onClick={() => setLiked(!liked)}>♥</button>
}
Now ProductPage, ProductDetails, and Reviews execute on the server. Only LikeButton ships JavaScript to the browser.
Key Takeaway: Place 'use client' at the lowest component that needs interactivity, not its parents. This maximizes server execution and minimizes client bundle size—the bundle size win you learned about in lesson 1533.