Next.js vs React: what is the difference?
BeginnerNext.js interview questionBy UIRound, updated 17 November 2026
Short answer
React is a JavaScript library for building user interfaces out of components. It does not decide how you route between pages, fetch data, render on a server or bundle your code. Next.js is a framework built on React that makes those decisions for you: file-based routing, server rendering and static generation, React Server Components, Server Actions, image and font optimisation, and backend endpoints. You still write React components in a Next.js app.
Library vs framework
A library is code you call. React gives you components, state, hooks and a way to turn them into DOM updates, and stops there. A framework calls your code: it owns the project structure, the build, the server and the request lifecycle, and runs your components at the right moment.
So the honest answer to "Next.js or React?" is that it is not a choice between two alternatives. Every Next.js app is a React app. The real question is whether you want React plus a framework, or React plus your own choice of router, data fetching and build tool.
What Next.js adds on top of React
- Routing from the file system. A folder in
app/is a URL segment,page.tsxmakes it public, and[id]makes a dynamic segment. Nestedlayout.tsxfiles wrap child routes and keep their state on navigation. In plain React you add a router library and define routes in code. - Rendering modes. Pages can be prerendered at build time, rendered per request, regenerated in the background, or streamed in pieces. You choose per route, or per component with Cache Components in Next.js 16. SSR vs SSG vs ISR explains each.
- Server Components and Server Actions. These are React features, but they need a bundler and server that understand them. Next.js provides that, so components can query a database directly and ship no JavaScript, and forms can call server functions. See Server Components vs Client Components.
- Images, fonts and links.
next/imageresizes, serves modern formats and lazy-loads images;next/fontself-hosts fonts with no layout shift;next/linkprefetches routes before the user clicks. - Backend endpoints. Route Handlers (
app/api/.../route.ts) answer HTTP requests with the WebRequestandResponseAPIs. The older Pages Router calls these API Routes (pages/api). Proxy, which was called middleware before Next.js 16, runs before a request reaches a route. - SEO and metadata. The Metadata API sets titles, descriptions and Open Graph tags per route, and the HTML arrives from the server already filled in.
- Build tooling. Turbopack is the default bundler for development and production builds, with webpack still available through a flag.
Side-by-side comparison
| React with Vite | Next.js | |
|---|---|---|
| What it is | UI library plus a build tool | Full-stack framework built on React |
| Routing | Add a library such as React Router | File-system routing with nested layouts |
| Default rendering | Client-side: an HTML shell, then JavaScript renders | Server-rendered or prerendered HTML, then hydration |
| Server Components | Not without extra setup | Built in (App Router) |
| Data fetching | Your choice, usually in the browser | On the server in async components, or on the client |
| Backend code | Separate server | Route Handlers and Server Actions in the same project |
| SEO for public pages | Needs extra work | Good by default |
| Hosting | Any static file host or CDN | A Node.js server, a platform adapter, or static export |
| Learning surface | Smaller | Larger: server and client boundaries, caching, routing rules |
When plain React with Vite is enough
Next.js solves problems that not every app has. A client-rendered single-page app built with Vite is a sound choice when:
- The app sits behind a login, so search engines never see it and server HTML gives little benefit. Admin panels, internal tools and dashboards are typical.
- You already have a backend, perhaps in another language, and want the frontend to be static files on a CDN.
- The app is a widget or micro-frontend embedded in another page.
- The team wants fewer moving parts and no server to run.
Next.js earns its extra complexity for public, content-heavy or SEO-sensitive sites, such as e-commerce, marketing pages, blogs and docs, and for apps that benefit from rendering close to the data. A middle ground also exists: Next.js can build a fully static site with output: 'export', losing request-time features but keeping its routing and build.
What interviewers listen for
A strong answer avoids "Next.js is better than React". Say that Next.js is React with decisions made: routing, rendering strategy, server code and asset optimisation. Then show you know the cost: a server to run, a client and server boundary to reason about, and caching rules to learn. Finish with a concrete choice for a concrete app. For the broader trade-offs between rendering strategies, the Rendering strategies guide goes deeper.
Practise it
Choose a rendering strategy per route for a marketplace is the decision Next.js lets you make, and Build Next.js App Router routing from files shows how its file routing works inside. Compare it with Implement a basic client-side router using the History API, which is what a plain React app needs, then try Decide the server/client component boundary for a Next.js product page and Migrate a large webpack app to Vite or Next.js.
Common follow-up questions
Do I need to learn React before Next.js?
Yes. Components, props, state, effects and hooks are the same in both, and Next.js documentation assumes you know them. Learn React first, then the framework rules: routing, Server Components and data fetching.
Is Next.js a backend framework?
Partly. Route Handlers and Server Actions let you write server code, and many apps need nothing else. For heavy background jobs, long-lived connections or a large API used by several clients, a separate backend is usually a better fit.
Is Create React App still the way to start a React project?
No. Create React App is deprecated. New projects usually start with a framework such as Next.js or React Router, or with Vite for a client-only app.
Is Next.js faster than React?
Not by itself. Next.js can send HTML sooner and ship less JavaScript through Server Components, which often improves first load. A badly configured Next.js app, for example one that renders every request uncached, can be slower than a static React app on a CDN.
Mistakes to avoid
Treating Next.js and React as competing choices instead of a framework and the library it uses
Choosing Next.js for an internal dashboard only because it is popular, then paying for a server and its complexity with no SEO benefit
Marking every file
"use client"and getting a client-rendered app with a framework's overheadAssuming React alone gives server rendering or routing
Calling Server Components a Next.js invention
They are a React feature that Next.js implements.
Sources
Practise it in code
Interviewers rarely stop at the definition. These questions open in an editor with tests.
- Choose a rendering strategy per route for a marketplaceHard50 min
- Build Next.js App Router routing from files: dynamic and catch-all segments, route groups and conflictsMedium40 min
- Decide the server/client component boundary for a Next.js product pageHard45 min
- Migrate a large webpack app to Vite or Next.js without a feature freezeHard50 min
- Implement a basic client-side router using the History APIMedium45 min