When to use client and server components?
Assesses fundamental understanding of React conventions, runtime behavior, and memory/performance considerations.
Hiring managers look for precision, avoidance of ambiguous jargon, and ability to explain trade-offs under real production conditions.
You can efficiently build nextjs application if you are aware about which part of the application needs to use client components and which other parts needs to use server components. The common cases of both client and server components are listed below:
Client components:
- Whenever your need to add interactivity and event listeners such as onClick(), onChange(), etc to the pages
- If you need to use State and Lifecycle Effects like useState(), useReducer(), useEffect() etc.
- If there is a requirement to use browser-only APIs.
- If you need to implement custom hooks that depend on state, effects, or browser-only APIs.
- There are React Class components in the pages.
Server components:
- If the component logic is about data fetching.
- If you need to access backend resources directly.
- When you need to keep sensitive information((access tokens, API keys, etc) ) on the server.
- If you want reduce client-side JavaScript and placing large dependencies on the server.
Candidate Response Strategy & Interview Tips
- Start with a concise one-sentence summary: Deliver a direct, confident answer first before expanding into nuances.
- Demonstrate real-world trade-offs: Discuss where this approach excels and when you would avoid it in production systems.
- Discuss complexity & edge cases: Proactively explain time/space complexity or boundary conditions (null values, scale limits).
- Prepare for interviewer follow-ups: Technical hiring panels frequently probe deeper into concurrency, backward compatibility, or alternative libraries.