▲ Next.js Tutorial
← PrevNext →
Introduction to Next.js
What Next.js is and why developers use it.
Introduction to Next.js
Next.js is a React framework that adds routing, server-side rendering, and a lot of built-in tooling on top of React — so you can build production-ready apps without wiring everything up yourself.
npx create-next-app@latest my-app
cd my-app
npm run dev
Why Next.js?
- File-based routing — no router library needed
- Server and client components in the same app
- Built-in image, font, and script optimization
- Easy deployment on Vercel or any Node host
Your First Page
// app/page.js
export default function HomePage() {
return <h1>Hello, Next.js!</h1>;
}
Advertisement728 x 90
Common Errors & Troubleshooting
npx create-next-apphangs or fails on an old Node version — Next.js requires a fairly recent Node.js (check the version shown increate-next-app's error, if any). Runnode --versionand update Node if it's several major versions behind.- Port 3000 already in use — if another project's dev server is still running, Next.js will automatically try port 3001 instead and tell you in the terminal — check the actual URL it prints rather than assuming it's always
:3000. - Blank page with no error — double-check the file is actually named
page.js(notPage.js,index.js, or similar) inside theappdirectory — Next.js's App Router only recognizes that exact filename as a route's page.
Advertisement320 x 100