Questions
5 of 27
1What are client components?
2How to implement client rendering in next js?
3Describe how client components are rendered.
4How to decide what part should be rendered on the server and what on the client?
5Combining client and server components
6How to render a server component in the client component?
7Discuss best approaches with client components.
8Does using 'use client' ensure that the component only renders on the client?
9Explain the full lifecycle of a CSR page in Next.js — from initial HTML delivery to interactive UI.
10What is the difference between useEffect data fetching and React Query / SWR in a CSR context?
11When would you choose CSR over SSR or SSG in a production Next.js app? Give real-world examples.
12How does React's concurrent rendering model affect CSR behaviour in Next.js 13+?
13How do you handle deeply nested Client Components without causing unnecessary re-renders?
14Explain the concept of "client component boundaries" — how do they affect the component tree?
15How would you implement optimistic UI updates in a CSR-heavy Next.js application?
16What are the challenges of using Context API at scale in a CSR and SSR? How do you solve them?
17How does next/dynamic work? How is it different from React's lazy() and Suspense?
18What is the "flash of unstyled/unloaded content" problem in CSR, and how do you prevent it?
19How do you prefetch data for CSR pages in Next.js to reduce perceived latency?
20How do useMemo and useCallback help performance in CSR components? When are they overkill?
21How do you implement skeleton screens or loading states for CSR data fetching?
22Compare SWR vs React Query vs useEffect for client-side data fetching — when do you use each?
23How do you implement infinite scrolling or pagination purely on the client side in Next.js?
24How do you handle race conditions in CSR data fetching with useEffect?
25What is the difference between client-side fetch and server actions in Next.js App Router?
26How do you cancel in-flight API requests when a component unmounts in CSR?
27How would you handle real-time data (WebSockets / SSE) in a Next.js CSR component?
05 / 27

Combining client and server components

  1. 1

    During a request-response lifecycle, your code moves from the server to the client. If you need to access data or resources on the server while on the client, you'll be making a new request to the server - not switching back and forth.

  2. 2

    When a new request is made to the server, all Server Components are rendered first, including those nested inside Client Components. The rendered result (RSC Payload) will contain references to the locations of Client Components. Then, on the client, React uses the RSC Payload to reconcile Server and Client Components into a single tree.

  3. 3

    Since Client Components are rendered after Server Components, you cannot import a Server Component into a Client Component module (since it would require a new request back to the server). Instead, you can pass a Server Component as props to a Client Component. See the unsupported pattern and supported pattern sections below.

  4. 4

    You cannot import a Server Component into a Client Component

Difficulty: 5/10
Topics: client components, server components, data fetching

Scenario Questions

0-2 years experience
  1. 1

    You need to display a list of products fetched from an API, and each product has an 'Add to Cart' button that updates client state. How would you decide which parts of this page should be a server component and which should be a client component in Next.js?

  2. 2

    If you accidentally import a client‑only hook like useState inside a server component, what error will you see at build time, and how do you fix it?

  3. 3

    Describe the steps to convert an existing server component page into a hybrid page that includes a client component for interactive UI.

2-5 years experience
  1. 1

    Your team added a client component inside a server component to handle a modal, but the page's initial load time increased dramatically. Walk me through how you would investigate and what trade‑offs you might consider.

  2. 2

    During a code review you notice that a server component is importing a heavy third‑party UI library that only needs to run in the browser. How would you refactor it, and what impact does it have on bundle size and SSR?

  3. 3

    Explain why a server component cannot directly use useEffect, and how you would restructure code that currently relies on it.

5-8 years experience
  1. 1

    We need to build a dashboard that streams real‑time data via WebSockets while still leveraging server components for SEO‑critical sections. How would you architect the component hierarchy to balance streaming updates and server‑side rendering?

  2. 2

    A legacy page mixes client and server logic, causing hydration mismatches in production. Describe a systematic approach to isolate client behavior, minimize hydration errors, and ensure performance at scale.

  3. 3

    Consider a multi‑tenant SaaS app where each tenant can customize UI widgets. How would you design a component loading strategy that uses server components for static parts but dynamically loads client components per tenant without blowing up the bundle?

8+ years experience
  1. 1

    Our organization is migrating a large monolithic Next.js app to use the new app directory with server and client components. What high‑level migration plan would you propose to minimize risk, handle cross‑team dependencies, and maintain backward compatibility?

  2. 2

    Discuss the long‑term maintenance implications of over‑using client components in a codebase that aims for edge‑rendered server components. How would you set guidelines and tooling to enforce a healthy balance?

  3. 3

    When evaluating whether to move a piece of business logic from a client component to a server component, what criteria (performance, security, data freshness) would you weigh, and how would you measure the impact after the change?

Follow-up Questions

  • What metrics would you watch after making the split to ensure performance improved?
  • Can you think of any edge cases where moving code to a server component could break functionality?
  • How would you communicate these component boundaries to other engineers on the team?