When building with Next.js App Router, it's tempting to add "use client" to a page as soon as one component needs state or event handlers.
But that decision can affect the client-side module graph and the JavaScript the browser needs to load.
A more deliberate approach is to separate server-side responsibilities from browser-dependent interactions.
For example, a product page might use:
- A Server Component for fetching and displaying product information.
- A Client Component for selecting product variations.
- A Client Component for cart interactions.
- Server Components for related product content.
The exact boundaries depend on the application's needs. Server Components aren't automatically better for every situation, and Client Components aren't inherently bad.
The important thing is to understand what each component needs to do.
I covered the differences, common misconceptions, composition patterns, and practical decision-making in my latest article:
React Server Components vs. Client Components: How to Choose the Right Boundary
Read the full article on Medium: [https://medium.com/@md-abu-noman/react-server-components-vs-client-components-how-to-choose-the-right-boundary-975141351036?sharedUserId=md-abu-noman]
Question for the community: What's your approach to deciding where "use client" belongs in a Next.js application?
Top comments (0)