As asked
You are building a product dashboard in Next.js 14 with the App Router. Walk me through how you decide which components to keep as Server Components versus mark with 'use client', and what concrete problems arise when you get that boundary wrong.
Sample answer outline
Server Components run only on the server, so they can directly access databases and secrets without exposing them to the client bundle, but they cannot hold state or attach event listeners. The boundary mistake that bites most people is importing a 'use client' component from a Server Component that passes non-serializable props like functions or class instances, which throws a serialization error at runtime. A strong answer mentions that context providers must be Client Components, that you can pass Server Component output as children to a Client Component wrapper, and that mixing them carelessly inflates the JS bundle with code that did not need to ship.
Expect these follow-ups
- How does streaming with Suspense change your data-fetching strategy in the App Router?
- If a Server Component needs to share state with a Client Component, what are your options?