Question presented to candidate: "Our team builds React single-page apps with Vite. Why would we move to Next.js, and what does it actually add on top of React?"
What a strong answer should cover:
- React is a UI library; Next.js is a full-stack framework built on it that decides routing, rendering, data fetching, bundling and deployment.
- It renders on the server (static, ISR, dynamic, streaming, partial prerendering), so pages arrive with content and metadata, which helps SEO and first paint.
- React Server Components are the default, so server-only code and data access do not ship to the browser.
- It includes file-based routing, layouts, Server Actions and Route Handlers for the backend, image and font optimization, Metadata API, and Turbopack.
- The trade-off: a server runtime (or a platform), more concepts to learn (caching, server and client boundaries), and framework conventions.
Clarifying questions expected:
- "Is the app mostly behind a login or public and SEO sensitive?" β server rendering matters most for public pages.
- "Where will it run?" β a Node server, a platform, or static hosting changes which features are available.
Code / implementation expected: Yes β a minimal App Router app with a server page and a client component.