LearnFrenzy
Sign in Take a free test

Getting Started with Next.js · Lesson 1 of 24

What Is Next.js? Next.js vs React

5 min read Updated Nov 8, 2026 Saurabh Samir

Next.js is a full-stack framework built on React, made by Vercel. React gives you components; Next.js gives you everything around them that a real website needs – routing, rendering on the server, data fetching, caching, image and font optimisation, SEO metadata and API endpoints – with sensible defaults. It powers sites such as Nike, Notion, TikTok, Twitch and the OpenAI and Anthropic websites, and it's the framework the React team recommends for new apps.

In this lesson

  • What Next.js adds to React
  • How a Next.js page is rendered
  • A first page, built and served for real
  • Next.js or React with Vite?

What Next.js adds to React

NeedReact with ViteNext.js
Pages and URLsadd React Routerbuilt in: folders are routes
HTML for search enginesempty <div id="root"> until JavaScript runsfull HTML from the server
Data fetchinguseEffect or TanStack Query in the browserasync Server Components on the server
Backend codea separate API serverServer Actions and Route Handlers in the same project
Images, fonts, SEO tagsdo it yourselfnext/image, next/font, the Metadata API
Cachingin the browser onlyon the server too, with "use cache"

Everything you learned about components, props, state and hooks in our React course still applies. Next.js decides where each component runs and when its HTML is produced.

Your first Next.js page

In Next.js, a file called page.tsx inside the app folder becomes a page. This component is async – it runs on the server, so it can load data directly before the HTML is sent:

// app/page.tsx
const courses = [
  { slug: "react", title: "React.js", lessons: 31 },
  { slug: "nextjs", title: "Next.js", lessons: 24 },
  { slug: "typescript", title: "TypeScript", lessons: 17 },
];

async function getCourses() {
  // in a real app: a database query or fetch() to an API
  return courses;
}

export default async function HomePage() {
  const list = await getCourses();
  return (
    <main>
      <h1>LearnFrenzy courses</h1>
      <ul>
        {list.map((c) => (
          <li key={c.slug}>{c.title} – {c.lessons} lessons</li>
        ))}
      </ul>
    </main>
  );
}

Build output and page

Route (app)
┌ ○ /


○  (Static)  prerendered as static content

LearnFrenzy courses
• React.js – 31 lessons
• Next.js – 24 lessons
• TypeScript – 17 lessons

The top part is what next build printed: the route / is marked ○ Static – Next.js rendered it to HTML once, at build time, because nothing in it depends on the incoming request. Every visitor (and Google) gets finished HTML instantly, with no JavaScript needed to see the content.

How a Next.js page is rendered

From request to interactive page

  1. ServerServer Components run (at build time or per request) and produce HTML plus a compact description of the UI
  2. Streamthe HTML is streamed to the browser – content appears before all JavaScript loads
  3. HydrateReact attaches event handlers to the interactive parts (Client Components)
  4. Navigatelater clicks fetch only what changed – no full page reloads
TermMeaning
Static (prerendered)HTML generated at build time, served from a CDN
DynamicHTML generated for each request (for example, it reads cookies)
Partial Prerenderinga static shell sent instantly, with dynamic parts streamed into it – the default with Cache Components in Next.js 16
Server Componentruns only on the server; its code never reaches the browser
Client Componentmarked "use client"; also runs in the browser so it can use state and events

Next.js or React with Vite?

  • Choose Next.js for public websites that need SEO and fast first loads (marketing sites, blogs, e-commerce, course platforms), and for full-stack apps where the frontend and backend live together.
  • Choose Vite + React for apps behind a login where SEO doesn't matter and you already have a separate API – internal dashboards, admin panels, embedded widgets.
  • Next.js can also export a fully static site (output: "export") for simple hosting.

App Router vs Pages Router

Next.js has two routers. The App Router (the app folder) is the modern one, with Server Components, layouts and streaming – this course uses it throughout. The older Pages Router (pages folder, getServerSideProps) is still supported, and you'll meet it in older codebases, but new projects should use the App Router.

Practice

Try it yourself

  1. Add a total line under the list: "72 lessons in all", calculated from the data.

    Show solution
    // app/page.tsx
    const courses = [
      { slug: "react", title: "React.js", lessons: 31 },
      { slug: "nextjs", title: "Next.js", lessons: 24 },
      { slug: "typescript", title: "TypeScript", lessons: 17 },
    ];
    
    export default async function HomePage() {
      const total = courses.reduce((sum, c) => sum + c.lessons, 0);
      return (
        <main>
          <h1>LearnFrenzy courses</h1>
          <ul>{courses.map((c) => <li key={c.slug}>{c.title}</li>)}</ul>
          <p>{total} lessons in all</p>
        </main>
      );
    }

    Page

    LearnFrenzy courses
    • React.js
    • Next.js
    • TypeScript
    72 lessons in all

Quick check

Is Next.js a replacement for React?

No – it's a framework built on React. You still write React components.

What does "○ Static" mean in the build output?

The page was rendered to HTML at build time.

Which router should new projects use?

The App Router (the app folder).

Summary

  • Next.js is a full-stack React framework: routing, server rendering, data fetching, caching and SEO built in.
  • Pages are Server Components by default and can be async; HTML is ready before JavaScript loads.
  • Use Next.js for public, SEO-sensitive and full-stack apps; Vite for client-only apps behind a login.

Finished this lesson?

Mark it complete to track your progress, then carry on with the next lesson.

Next lesson

Search LearnFrenzy

Esc

Quick links