Learnr

Learn Next.js

Turn your React skills into full-stack apps with routing and server rendering.

or browse all courses.

Free to start. Built from a single prompt. No credit card.

Next.js is a React framework, developed by Vercel, that adds the pieces React leaves out: file-based routing, server-side rendering, static generation, image optimization and backend endpoints in the same project. In the App Router, folders inside the app directory become URLs, layouts wrap pages, and components render on the server by default unless you mark them with use client. That lets you fetch data close to the database and send less JavaScript to the browser. Learnr builds a personalized Next.js course from your prompt and teaches it through short, interactive lessons, assuming you know React basics first.

How to learn Next.js, step by step

  1. Know React fundamentals first. Be comfortable with components, props, useState, useEffect and lists before starting. Next.js changes where code runs, which is far easier to follow when React itself feels familiar.
  2. Create an app and learn the folder structure. Run npx create-next-app@latest, choose the App Router, and explore the app directory. Add folders with page.js files and a shared layout.js to see routes and nested layouts appear.
  3. Understand server versus client components. Components are server-rendered by default and can fetch data directly. Add use client only to components that need state, effects or browser APIs, and keep those as small leaves of the tree.
  4. Fetch data and learn rendering modes. Fetch data in server components with async and await, and learn how static rendering, dynamic rendering and revalidation differ. Check the build output to see which routes are static.
  5. Add a backend inside the same project. Create a route handler that returns JSON and a form that submits through a server action, then connect a database. Validate input on the server, since anything from the browser can be tampered with.
  6. Build, deploy and polish. Run next build to catch errors, add metadata for SEO and use next/image and next/font. Deploy to a host that supports Next.js, and keep framework concepts fresh with short Learnr lessons.

What you'll learn

  • Create routes, layouts and dynamic segments with the App Router
  • Decide when to use server components and client components
  • Fetch data and control caching and revalidation
  • Build backend endpoints with route handlers and server actions
  • Optimize images, fonts and metadata and deploy a production build

What's inside your Next.js course

A sample path Learnr builds for Next.js. Your real course adapts to your goal and level.

  • 1. What Next.js adds on top of React
  • 2. File-based routing, layouts and navigation
  • 3. Server components and client components
  • 4. Data fetching, caching and rendering modes
  • 5. Route handlers, server actions and forms
  • 6. Metadata, optimization and deployment

How long does it take to learn Next.js?

With solid React, the App Router basics take 2 to 4 weeks at 5 hours a week, and a full-stack app with a database and authentication takes about 2 to 4 months. Without React experience, add a few months to learn it first.

What you need before you start

Working knowledge of React and modern JavaScript, plus basic HTML, CSS and the command line. Some familiarity with HTTP and APIs helps with the server-side parts.

Common mistakes to avoid

  • Adding use client to every file out of habit, which loses the benefits of server components. Start on the server and opt into the client only where interactivity is needed.
  • Following tutorials for the older Pages Router while using the App Router. Check which router a resource covers, since the APIs differ.
  • Exposing secrets by using them in client components. Keep API keys in server-only code and environment variables without the NEXT_PUBLIC_ prefix.

How Learnr builds your course

Type your topic

Tell Learnr you want to learn Next.js, or get as specific as you like.

Get a personalized course

Learnr instantly builds a full Next.js course tailored to your goal and skill level.

Learn and level up

Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.

Next.js questions, answered

Should I learn React before Next.js?

Yes. Next.js is built on React, and its routing and server features assume you already understand components, props and state. A few weeks of React first makes Next.js much clearer.

What is the difference between the App Router and the Pages Router?

The Pages Router is the older system using a pages directory. The App Router uses the app directory with layouts, server components and newer data fetching, and it is the recommended choice for new projects.

Do I have to deploy Next.js on Vercel?

No. Vercel makes Next.js, but you can self-host it on a Node.js server, in a Docker container or on other platforms that support it.

Explore more courses

More programming and tech courses

See all programming and tech courses

Ready to learn Next.js?

Start your free, personalized Next.js course in seconds. .