🎓 A1Learner
🔍
0 of 50 lessons completed

Next.js Next.js vs React

React alone draws pages. A real app also needs routing, a bundler, and a server, and Next.js ships all three.

One React component, no router

This component draws one list. It has no way to open a second page.

export default function Books() {
  return (
    <ul>
      <li>Dune</li>
      <li>The Hobbit</li>
    </ul>
  );
}

React draws, Next.js adds three jobs

The script prints the split. React draws the page, and Next.js adds three jobs.

node -e 'console.log("React draws the page."); console.log("Next.js adds routing."); console.log("Next.js adds server rendering."); console.log("Next.js adds deployment.");'

Example

const jobs = ["routing", "server rendering", "deployment"];
console.log("React alone: draws the page.");
console.log("Next.js adds " + jobs.length + " jobs:");
jobs.forEach((job) => console.log("- " + job));

Key points

  • Router: the tool that maps a web address to a page
  • Bundler: the tool that packs the code files into files a browser can load
  • Server: the computer that answers when a reader opens a web address
  • React alone gives you none of these three. You must pick and wire each one by hand.
  • Next.js ships all three. One install gives you the router, the bundler, and the server.
  • Use plain React for a small widget or a single page with no links.

In this example, the list holds the three jobs that plain React leaves out. React alone draws the page, and that is its one job. Next.js adds routing, so each web address opens its own page. It adds server rendering, so the server builds the page first. It adds deployment, so the app can go live. Three jobs is the whole difference.

Note

Use Next.js when the app has more than one page. Links between pages are where plain React starts to hurt.

Try it Yourself

Edit the code, then press Run.

Running is simulated · TypeScript Playground

Exercise

Which three jobs does plain React leave out?