Sikau

Next.js · Day 1 · about 25 min

What is Next.js?

React with routing, servers and data built in.

React, ready for production

React draws components. A real website also needs pages with URLs, fast first loads, search-engine friendly HTML, data from a database and somewhere to run server code. Next.js is a React framework that gives you all of that — it's what Sikau itself is built with.

Engine and car: React is a great engine. Next.js is the car around it: wheels (routing), a dashboard (data loading), safety features (server code, caching) and a road to drive on (deployment).

The App Router: folders are URLs

  • A Next.js project has an app/ folder. Each folder is a URL segment; a page.jsx inside makes that URL a page.
  • app/page.jsx → /, app/menu/page.jsx → /menu, app/about/team/page.jsx → /about/team.
  • app/layout.jsx wraps every page. The root layout renders <html> and <body>.
  • Pages are Server Components by default: they run on the server and send HTML — no JavaScript needed in the browser unless you ask for it.
export default function HomePage() {
  return (
    <section>
      <h1>Himalayan Café</h1>
      <p>Momos, tea and home cooking in Pokhara.</p>
    </section>
  );
}

On your computer: npx create-next-app@latest my-cafe, then npm run dev and open http://localhost:3000.

The rest of this lesson

  • Why server rendering mattersexplain
  • Anatomy of a Next.js projectexplain
  • Which URL?predict
  • File → URLmatch
  • Your turnwrite code
  • Badge quizquiz
  • What you learnedrecap

Continue this lesson free — run real code in your browser

Continue with Google

See all 19 lessons of Next.js