Next.js 16 & TypeScript 5 Senior Interview Questions (2026 Guide)

Practical answers to React Server Components children composition, revalidateTag vs revalidatePath, Server Actions authorization, and TypeScript discriminated unions.

1. Passing a Server Component into a Client Component via children

Importing a Server Component directly inside a 'use client' file converts that child into a client bundle module. Instead, pass it as children or a named JSX prop from the parent Server Component so React serializes the RSC payload on the server without shipping server dependencies to the browser.

// ServerPage.tsx
export default function Page() {
  return (
    <ClientDrawer>
      <ServerRevenueTable /> {/* stays server-only */}
    </ClientDrawer>
  );
}

2. Choosing revalidateTag over revalidatePath

revalidatePath invalidates an entire route segment cache, forcing unrelated widgets on that route to refetch. Tag-based caching (fetch(..., { next: { tags: ['invoices'] } })) lets a Server Action purge only affected queries across multiple routes simultaneously.

import { revalidateTag } from 'next/cache';
export async function markPaid(id: string) {
  await db.invoices.update({ where: { id }, data: { status: 'paid' } });
  revalidateTag('invoices');
}

3. Strict Discriminated Unions for Async UI States

Boolean bags (isLoading, isError, data) allow impossible states like loading=true and error!=null at the same time. Discriminated unions enforce compile-time exhaustiveness with a never check.

type AsyncState<T> =
  | { status: 'idle' }
  | { status: 'loading' }
  | { status: 'error'; message: string }
  | { status: 'ready'; data: T };
Launch Free 8-Card Interactive Quiz Download All 30+ Cards PDF + Interactive Quiz ($1 USD)