← All topics

Next.js Senior interview questions and answers

75 questions for a Next.js (Senior) interview - with correct answers, explanations and links to the docs.

Take this quiz
  1. 1.What is the RSC payload?
  2. 2.What happens during client navigation via <Link> in the App Router?
  3. 3.With cacheComponents: true, the dev overlay shows "blocking route". What does it mean?
  4. 4.How does 'use cache: remote' differ from 'use cache'?
  5. 5.What do you need to consider when self-hosting Next.js on several Kubernetes pods?
  6. 6.What do the stale, revalidate and expire parameters in cacheLife mean?
  7. 7.How does Next.js protect Server Actions from CSRF?
  8. 8.Why shouldn't Server Actions be used for loading data?
  9. 9.A Server Action is declared inside a component and uses a variable from its closure. What happens to it?
  10. 10.What is the React Taint API (experimental_taintObjectReference) for in Next.js?
  11. 11.Why does a CSP with a nonce make pages dynamic?
  12. 12.Why does error.tsx in production get a generic message for an error from a server component?
  13. 13.What changed in next/image defaults in Next.js 16?
  14. 14.Which runtime does proxy.ts use in Next.js 16?
  15. 15.What prefetching optimizations appeared in the Next.js 16 router?
  16. 16.What does optimizePackageImports do?
  17. 17.When do you need the serverExternalPackages option?
  18. 18.What is Draft Mode for?
  19. 19.What is the instrumentation.ts file with a register() function for?
  20. 20.How do you implement on-demand ISR via a CMS webhook?
  21. 21.Why are Context providers in the App Router moved into a separate client component?
  22. 22.A third-party component uses hooks but has no 'use client'. How do you use it in a server page?
  23. 23.How do you get configuration from an environment variable at runtime rather than at build time?
  24. 24.What is version skew, and how does deploymentId help with it?
  25. 25.Why can't generateStaticParams return an empty array with Cache Components?
  26. 26.How do GET Route Handlers behave with Cache Components enabled?
  27. 27.What does the user get if a Server Action calls revalidatePath and returns a value?
  28. 28.How do you connect forbidden() and unauthorized() to UI?
  29. 29.How does metadata from generateMetadata behave during streaming?
  30. 30.When should you enable reactCompiler in Next.js 16?
  31. 31.How does unstable_rethrow help with error handling?
  32. 32.Why shouldn't a layout be the only place where authorization is checked?
  33. 33.What are Multi-Zones?
  34. 34.Why is page data sometimes sent twice - in the HTML and in the RSC payload?
  35. 35.What is prefetched for a dynamic route by <Link> with default settings?
  36. 36.How does refresh() from next/cache differ from revalidatePath?
  37. 37.How does Next.js 16 speed up repeated runs of next dev and next build?
  38. 38.What is typedRoutes useful for?
  39. 39.How does the Edge runtime differ from Node.js for routes?
  40. 40.A component shows new Date().toLocaleString() and causes a hydration mismatch. What's the most correct fix?
  41. 41.What does after() in a Route Handler give you compared to await logEvent() before responding?
  42. 42.How do you make sure a 'use cache' function doesn't cache different users' data together?
  43. 43.How does the URL-preserving modal pattern work in the App Router?
  44. 44.What's the right outcome for an error in generateStaticParams during the build?
  45. 45.Why does reading searchParams at the top level of a page reduce the benefit of PPR?
  46. 46.Which command generates the PageProps and LayoutProps types without running the dev server?
  47. 47.How does htmlLimitedBots differ from regular bot handling?
  48. 48.What happens if a layout calls await params at the top level with Cache Components and no generateStaticParams?
  49. 49.How does 'use cache' caching work on a serverless platform with the default handler?
  50. 50.Why do Server Actions get encrypted, non-deterministic IDs?
  51. 51.With Partial Prefetching enabled, what does await prefetch() inside a component do?
  52. 52.What does export const ensureStatic = 'shell' guarantee for a route?
  53. 53.What does export const instant = true in a segment do?
  54. 54.Why does useOffline() from next/offline always return false in a project?
  55. 55.With Cache Components, how do you reset a subtree on <Link> navigation but still restore it on browser Back?
  56. 56.How can a 'use cache' component accept children if JSX can't be serialized as a cache key?
  57. 57.Why does a 'use cache' function with cacheLife('seconds') end up as a dynamic hole instead of in the prerendered page?
  58. 58.Where do you plug in a shared cache store (e.g. Redis) for 'use cache' when self-hosting?
  59. 59.What is the Build Adapters API (adapterPath) for?
  60. 60.Why can next dev and next build run at the same time in Next.js 16?
  61. 61.publicRuntimeConfig was removed in Next.js 16. How do you provide config that differs per environment without rebuilding?
  62. 62.The site uses scroll-behavior: smooth, and after upgrading to Next.js 16 every navigation scrolls smoothly to the top. How do you restore instant jumps?
  63. 63.Why is images.domains deprecated in favor of images.remotePatterns?
  64. 64.Why does Next.js 16 block optimizing images from local IP addresses by default?
  65. 65.Why shouldn't a server component fetch your own Route Handler (/api/products) for data?
  66. 66.A Server Action deletePost(id) is used only on an admin page. Why must it still check authorization itself?
  67. 67.How do you apply a saved theme or locale-specific date before the first paint without a hydration error or flash?
  68. 68.How does generateStaticParams work for nested dynamic segments like /[category]/[product]?
  69. 69.notFound() is called inside a component that streams in a <Suspense> boundary. What does the crawler get?
  70. 70.Why should proxy.ts do only optimistic auth checks?
  71. 71.A CDN in front of a self-hosted Next.js keeps serving an old page after revalidateTag(). Why?
  72. 72.A catalog has 1M products. How do you build quickly but still serve all of them statically (without Cache Components)?
  73. 73.Where does Turbopack configuration live in Next.js 16?
  74. 74.What changed for the props of opengraph-image, icon and apple-icon functions in Next.js 16?
  75. 75.With Cache Components, when is connection() still the right choice over io()?