What is Next.js and how does it differ from React?

React is a UI library for building components; Next.js is a full-stack React framework that adds routing, server rendering, data fetching, caching, bundling and deployment conventions on top of React.

What React gives you

React renders components and manages state. It does not decide how URLs map to screens, where data is fetched, how code is bundled or how HTML reaches the browser. A plain React app (for example with Vite) is usually a client-rendered single-page app, and you pick a router, data library and server yourself.

What Next.js adds

  • File-system routing. Folders in app/ become URLs, with nested layouts, loading and error states.
  • Server-first rendering. Components are React Server Components by default. They run on the server, can read a database directly and send no JavaScript for themselves.
  • Prerendering and streaming. Pages are prerendered into a static shell where possible, and dynamic parts stream in behind <Suspense>.
  • Caching model. With Cache Components (cacheComponents: true, the default for new apps in Next.js 16.4) you mark cacheable work with "use cache".
  • Backend features. Route Handlers for HTTP APIs, Server Functions for mutations, and proxy.ts to run code before a request is handled.
  • Tooling. Turbopack is the default bundler for next dev and next build since Next.js 16, plus built-in image, font and script optimization.

How to explain it in an interview

"React is the engine; Next.js is the car." You still write React components, but Next.js decides where each one runs, what is cached and how it is delivered. The trade-off is convention: you follow its file structure and server/client rules in exchange for performance and less setup.

Current versions

Next.js 16 shipped in October 2025. The latest minor is 16.4 (October 2026), which uses React 19.2+ features such as View Transitions, useEffectEvent and <Activity>.

Code example

tsx
1// app/page.tsx - a Server Component by default (no "use client")
2import { db } from "@/lib/db";
3import LikeButton from "./like-button";
4
5export default async function Home() {
6 // Runs only on the server: safe to query the database directly
7 const posts = await db.post.findMany({ take: 5 });
8
9 return (
10 <main>
11 <h1>Latest posts</h1>
12 {posts.map((p) => (
13 <article key={p.id}>
14 <h2>{p.title}</h2>
15 {/* Only this small piece ships JavaScript to the browser */}
16 <LikeButton postId={p.id} />
17 </article>
18 ))}
19 </main>
20 );
21}
22
23// app/like-button.tsx
24// "use client";
25// export default function LikeButton({ postId }: { postId: string }) {
26// const [liked, setLiked] = useState(false);
27// return <button onClick={() => setLiked(!liked)}>{liked ? "♥" : "♡"}</button>;
28// }

Practice this question

Open it in the study app to track progress, take notes, listen to the answer and work through the rest of the Next.js set.

Open in study app