
Next.js vs React: What Is the Difference and Which to Use?
Next.js vs React explained — library vs framework, rendering (CSR, SSR, SSG), routing, SEO, data fetching, deployment and when to use each.
Learn Next.js step by step: the App Router, Server Components, rendering options, metadata for SEO, images and how to build and deploy a Next.js website.
Next.js is a React framework for building fast websites and web apps. Create a project with npx create-next-app@latest, add pages as folders inside the app directory (the App Router), use Server Components to fetch data on the server, choose static generation or server rendering per route, and export a metadata object for SEO titles and descriptions. Deploy on Vercel or any Node.js host.
Next.js adds routing, rendering, data fetching and performance features to React, which makes it a popular choice for marketing sites, blogs, ecommerce and SaaS apps. This guide covers the App Router, which is the recommended approach for new projects.
Use a current LTS version.
Run npx create-next-app@latest my-site and accept the defaults (TypeScript, ESLint, App Router).
Run npm run dev and open http://localhost:3000.
| File | URL |
|---|---|
app/page.tsx | / |
app/about/page.tsx | /about |
app/blog/[slug]/page.tsx | /blog/any-post |
app/layout.tsx | Shared layout for all pages |
// app/blog/[slug]/page.tsx
import type { Metadata } from 'next'
async function getPost(slug: string) {
const res = await fetch(`https://api.example.com/posts/${slug}`, { next: { revalidate: 3600 } })
return res.json()
}
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
const { slug } = await params
const post = await getPost(slug)
return { title: post.title, description: post.excerpt }
}
export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
const post = await getPost(slug)
return <article><h1>{post.title}</h1><p>{post.body}</p></article>
} This page is a Server Component: it fetches data on the server, sends ready HTML to the browser and refreshes the cached data every hour.
| Option | When HTML is created | Best for |
|---|---|---|
| Static generation | At build time | Marketing pages, docs, blogs |
| Incremental revalidation | At build time, refreshed periodically | Blogs and catalogues that change occasionally |
| Dynamic server rendering | On each request | Personalised or frequently changing pages |
| Client components | In the browser | Interactive widgets, forms and dashboards |
sitemap.xml and robots.txt with the built-in file conventions.
next/image for responsive, lazy-loaded images and next/font for self-hosted fonts.
Next.js is popular for “headless” stores: products and checkout come from a commerce platform such as Shopify, BigCommerce or WooCommerce via APIs, while Next.js renders a fast custom storefront. It offers great performance and design freedom but needs more development work than a standard Shopify theme.
Vercel, the company behind Next.js, offers simple Git-based deployment. You can also deploy to any Node.js host, a container platform or as a static export if your site does not need server features.
Compare frameworks in Next.js vs React and learn the basics first in our React tutorial.
Learn how HTML structures modern websites — from document basics and semantic elements to forms, media, accessibility, SEO and practical…
Learn how CSS controls the appearance, layout, responsiveness and visual behaviour of modern websites — from selectors and the box…
Learn JavaScript from the fundamentals to DOM manipulation, events, functions, asynchronous programming, APIs, modules, browser storage and modern frontend development.
Learn PHP from the fundamentals to server-side programming, forms, databases, APIs, object-oriented programming, WordPress development, security and modern backend development.
Learn React from the fundamentals to components, JSX, props, state, hooks, forms, APIs, performance, accessibility, testing and modern frontend application…
A beginner-friendly Angular tutorial: what Angular is, how components, signals and services work, how to start a project and when…
Learn Vue.js 3 step by step: create a project, build single-file components, use reactive state with the Composition API and…
Learn Laravel from PHP framework fundamentals and MVC architecture to routing, controllers, Blade, Eloquent, databases, APIs, authentication, security, testing, performance…

Next.js vs React explained — library vs framework, rendering (CSR, SSR, SSG), routing, SEO, data fetching, deployment and when to use each.

React vs Vue compared — syntax, learning curve, reactivity, ecosystem, performance, meta-frameworks (Next.js vs Nuxt), jobs and which to choose.

Fifteen React projects for beginners to advanced developers — from a to-do app and weather dashboard to a full-stack app — with the React skills each one teaches.
Short, honest answers to the questions people ask most about this topic.
Next.js is built on React, so it is not a replacement. It adds routing, server rendering, static generation and performance features, which makes it better suited to full websites than plain React.
Yes. Server rendering and static generation deliver complete HTML to search engines, and the Metadata API, sitemap support and image optimisation make technical SEO easier.
Yes. Learn React fundamentals — components, props, state and hooks — before Next.js, because every Next.js page is a React component.
Yes. Next.js is open source and free. Hosting costs depend on where you deploy, and Vercel has a free hobby tier.
Explore the rest of our Web Development guides, or follow the beginner path step by step.
We use essential cookies to run this site. With your permission we also use cookies for analytics and for advertising, including personalised ads from Google. You can change your choice at any time — see our Cookie Policy and Privacy Policy.