Tutorial 3 of 4
React vs Next.js
Only the places where Next changed or improved something you already do in React. Same task on both sides: plain React (Vite + React Router) on the left, Next (App Router) on the right. Things that are identical in both, such as props, state and hooks, are left out.
Project setup
React
Next
What Next added: routing, Tailwind, linting and a server come preconfigured. In React you pick and wire each one.
Routing
React
Next
What Next added: the folder structure is the route table. No router library, no central config file to keep in sync.
Dynamic routes
React
Next
What Next added: the parameter arrives as a prop on the server, so you can use it to load data before any HTML is sent.
Shared layouts
React
Next
What Next added: any folder can have its own layout.tsx, and layouts nest automatically. The layout also owns <html> and <body>, which React never touches.
Links
React
Next
What Next added: Link preloads the target page when it scrolls into view, so the click feels instant. On the server you also get redirect("/login").
Data fetching
React
Next
What Next added: server components can be async. The data is fetched on the server and the browser receives ready HTML: no effect, no loading state, no empty first paint, and the API URL and keys stay private.
Loading and error states
React
Next
What Next added: one file per route for each state. Under the hood these are React's own Suspense and error boundaries, set up for you.
Forms and saving data
React
Next
What Next added: Server Actions. The form calls a server function directly, so you write no endpoint and no fetch, and revalidatePath refreshes the page data. React 19 defines <form action>; Next supplies the server side of it.
Auth and protected pages
React
The check runs in the browser, after the page code has already been downloaded.
Next
The check runs on the server, before anything is sent.
What Next added: a server to do auth on. The token lives in an httpOnly cookie that browser scripts cannot read, and a logged out user never receives the protected page at all.
Backend endpoints
React
None. React runs only in the browser, so you need a separate backend (FastAPI, Express) and usually a dev proxy:
Next
What Next added: route handlers. Frontend and small backend endpoints live in one project and deploy together. You can still call a separate backend from server code.
Images
React
Next
What Next added: automatic resizing per screen size, modern formats (WebP, AVIF), lazy loading by default and reserved space so the layout does not jump.
Fonts
React
Next
What Next added: the font is downloaded at build time and served from your own domain. No extra network request, no flash of a fallback font.
Page title and SEO
React
Set in the browser. A crawler that does not run JavaScript sees an empty page.
Next
Written into the HTML on the server, along with the page content.
What Next added: a typed metadata API and server rendered HTML, so search engines and link previews get the real title, description and content.
Code splitting
React
Next
What Next added: splitting per route by default, and server components ship no JavaScript at all.
Environment variables
React
Every value is visible in the browser bundle.
Next
What Next added: real secrets. Variables without the NEXT_PUBLIC_ prefix never leave the server.
Where rendering happens
React
One mode: client side rendering.
Next
Per route: static at build time, refreshed on a timer, or rendered on every request.
What Next added: the server/client split ("use client"), faster first paint, and a choice of rendering mode for each page.
Build and deploy
React
Upload dist/ to any static host. Configure it to serve index.html for every path.
Next
Needs a Node runtime: Vercel, or Docker with output: "standalone".
What Next added: a production server, which is what makes everything above possible. The cost is that hosting is no longer a folder of files.
Which one to pick
Plain React fits when
- The app sits behind a login and SEO does not matter (internal tools, admin panels).
- You already have a backend API and want a static frontend.
- You want the smallest set of concepts to learn first.
Next fits when
- Pages must be found by search engines or load fast on first visit.
- You want auth, data access and UI in one project.
- You would otherwise assemble router, data layer and server yourself.
Remember: everything from the React tutorial still applies inside Next. Next changes where code runs and how pages are wired, not how components work.