Explain it simply
Explain it simply
If you already know React, you can build UI pieces such as buttons, cards and forms. A whole website still needs many more decisions, though: which page answers each URL, where the data comes from, and how to serve everything quickly in production.
Next.js is a React framework that makes those decisions in an organised way. This course is not a pile of throwaway snippets. You will grow one note-sharing app, "Myanmar Notes", a little in every lesson, all the way to deploying it to production.
Problem → Why → Solution
The problem: copying code without knowing each file's job
Most people starting Next.js have no trouble writing React components. The trouble starts when code copied from a tutorial fails with an error saying useState only works in Client Components, or when a URL shows 404 because the file was not named page.tsx. The code itself is fine; what is missing is knowing which file it belongs in and where it runs.
A second trap is assuming that what works on the development server is ready for production. A production build checks code more strictly and pre-renders pages, so errors that never appeared in development can surface there.
Why does this happen?
In Next.js the file name and folder location carry meaning, and each component runs either on the server or in the browser. Copy code without understanding those two rules and the error messages feel like riddles. That is why this course starts with file-based routing and introduces the server/browser split early.
Core concept: the big ideas of Next.js and the shape of this course
This course teaches the Next.js App Router. In the App Router every folder under app is a URL segment, and a page.tsx file is the UI shown at that URL: app/notes/page.tsx becomes /notes. There is no separate router configuration to write; the folder structure is the router.
The second big idea is Server Components versus Client Components. Components in the app folder are Server Components by default: they render on the server, can read a database directly, and their code is not shipped to the browser as JavaScript. Only the parts that need clicks, state or browser APIs are split out as Client Components by writing "use client" at the top of the file.
| Chapter | What you learn |
|---|---|
| Basic (6 lessons) | What Next.js is, installation, project structure, pages and layouts, CSS, images and fonts |
| Intermediate (10 lessons) | Links and navigation, dynamic routes, route groups, loading/error UI, metadata, Server/Client Components, data fetching, streaming, caching, search params |
| Advanced (12 lessons) | Route Handlers, Server Actions and forms, a database layer, auth, security, testing, performance, building and deploying (Vercel and Docker) |
| Projects (3 lessons) | Build the Link Stash app from setup to deployment |
| Exercises (2 lessons) | Practice sets on routing and layouts, then data and actions |
To start you need HTML, CSS, JavaScript and React's components, props and state. The code is written in TypeScript (.tsx), but a basic grasp of type annotations is enough. Next.js releases new versions often, so wherever behaviour differs between versions the lesson says so and points you to the official docs.
Next.js also has an older routing system, the Pages Router, which uses a pages/ folder. It is still supported, but the docs recommend the App Router for new projects, and every line of code in this course uses the App Router.
- The browser requests a URL
- Next.js finds the matching page.tsx
- Server Components render on the server
- Client parts become interactive
In every lesson ask two questions: which URL does this file serve, and where does this code run?
General pattern: the page file of a route
// The folder path under app/ decides the URL
export default function PageName() {
const data = "values to show";
return (
<main>
<h1>Heading for this URL</h1>
<p>{data}</p>
</main>
);
}A page file default-exports one React component. The file's location (its folder path under app/) decides the URL, and the component's JSX is the UI shown there. Without "use client" it is a Server Component.
Example: a home page that shows the course map
This file is app/page.tsx in a Next.js project, so it appears at the site's "/" URL. It keeps the chapter list as data, adds up the total number of lessons, and shows a heading, a summary line and a numbered list. After the installation lesson you can drop it into your own project; for now, read it and predict what appears.
const chapters = [
{ name: "Basic", lessons: 6 },
{ name: "Intermediate", lessons: 10 },
{ name: "Advanced", lessons: 12 },
{ name: "Projects", lessons: 3 },
{ name: "Exercises", lessons: 2 },
];
export default function HomePage() {
const total = chapters.reduce((sum, chapter) => sum + chapter.lessons, 0);
return (
<main>
<h1>Learning Next.js with Myanmar Notes</h1>
<p>
{chapters.length} chapters, {total} lessons.
</p>
<ol>
{chapters.map((chapter) => (
<li key={chapter.name}>
{chapter.name}: {chapter.lessons} lessons
</li>
))}
</ol>
</main>
);
}Code breakdown
- Data
const chapters = [The chapter list is a plain array outside the component. In later lessons this kind of data will come from a database or an API, fetched on the server.
- Default export
export default function HomePage() {page.tsx must default-export a component, and Next.js renders it for "/". There is no "use client", so this is a Server Component.
- Total
const total = chapters.reduce((sum, chapter) => sum + chapter.lessons, 0);6 + 10 + 12 + 3 + 2 = 33, so total is 33. The sum is computed on the server, and the browser only receives the resulting HTML.
- Summary line
{chapters.length} chapters, {total} lessons.The expressions inside { } are evaluated, producing "5 chapters, 33 lessons.".
- List
<li key={chapter.name}>chapters.map() returns one <li> per chapter, and key lets React tell the items apart. Because the list is an <ol>, the browser numbers them 1 to 5.
Opening "/" shows the heading "Learning Next.js with Myanmar Notes", the line "5 chapters, 33 lessons.", and a numbered list: 1. Basic: 6 lessons, 2. Intermediate: 10 lessons, 3. Advanced: 12 lessons, 4. Projects: 3 lessons, 5. Exercises: 2 lessons.How to work through a lesson
1. Read the problem first
Knowing which pain a feature removes makes its syntax much easier to remember.
2. Type the code yourself
Type rather than paste, and notice which folder each file goes in. In Next.js a file's location matters as much as its code.
3. Read the error
The error overlay names a file and a line. Do not dismiss it; find which file and which rule it is talking about.
4. Attempt the challenge before the solution
The starter code only has TODOs. Filling them in yourself is how you find out what you have not understood yet.
In real projects
Next.js in real projects
Next.js is used for marketing sites, blogs, documentation, e-commerce stores and logged-in dashboards. The reason is that each route can choose whether it is pre-rendered as static HTML at build time or rendered on the server for every request. Blog posts can be static and instant while a user's dashboard shows live data.
Inside a team, the conventions help a lot. A new developer can look at the app folder and immediately see which URLs the site has. The Myanmar Notes app in this course grows the same way: two static pages at first, then a database, login, forms and finally a production deployment. In the Projects chapter you rebuild a smaller app, Link Stash, from scratch to test what you have learned.
Common mistakes
Common mistakes
1. Pasting code without asking what the file is for
Before adding a tutorial snippet to your project, decide whether it is a page, a layout or an ordinary component, and whether it must run on the server. Skip that step and the file lands in the wrong place, giving you a 404 or a Client Component error.
2. Treating "works in dev" as "ready for production"
pnpm dev is designed to show changes quickly. pnpm build catches type errors and errors that only appear while pre-rendering pages. Get into the habit of running a build after finishing each feature.
3. Mixing old Pages Router tutorials with the App Router
Many older tutorials use a pages/ folder and getServerSideProps. That code does not work inside the app/ folder. When reading the docs, check that the App Router version is selected.
Mini challenge
Mini challenge: your study plan page
This challenge doubles as a check that your React basics are ready. Write a page that shows how many lessons you have finished in each chapter and your overall progress as a percentage.
- Type the progress data as an array of { chapter, done, total } objects
- Show each chapter as its own <li> in the form "Basic: 2/6"
- Append " (complete)" when a chapter is finished (done === total)
- Show overall progress as a whole-number percentage in a <p>, using Math.round()
type ChapterProgress = {
// TODO: chapter name, lessons done, lessons in total
};
const progress: ChapterProgress[] = [
// TODO: add at least three chapters, one of them complete
];
export default function StudyPlanPage() {
// TODO: add up done and total across all chapters, then work out the percent
return (
<main>
<h1>My study plan</h1>
{/* TODO: "Overall: N%" paragraph */}
{/* TODO: one <li> per chapter, with " (complete)" when finished */}
</main>
);
}Expected: With the data in the solution the page shows "Overall: 42%" (8 of 19) and the list "Basic: 6/6 (complete)", "Intermediate: 2/10", "Projects: 0/3".
Show hint
Add up done and total with one reduce() each. The percentage is Math.round((done / total) * 100). To add text only when a condition holds, use {isDone && " (complete)"}.
Show solution
type ChapterProgress = {
chapter: string;
done: number;
total: number;
};
const progress: ChapterProgress[] = [
{ chapter: "Basic", done: 6, total: 6 },
{ chapter: "Intermediate", done: 2, total: 10 },
{ chapter: "Projects", done: 0, total: 3 },
];
export default function StudyPlanPage() {
const done = progress.reduce((sum, item) => sum + item.done, 0);
const total = progress.reduce((sum, item) => sum + item.total, 0);
const percent = Math.round((done / total) * 100);
return (
<main>
<h1>My study plan</h1>
<p>Overall: {percent}%</p>
<ul>
{progress.map((item) => {
const isDone = item.done === item.total;
return (
<li key={item.chapter}>
{item.chapter}: {item.done}/{item.total}
{isDone && " (complete)"}
</li>
);
})}
</ul>
</main>
);
}Quick quiz 1 / 3
Quick quiz 2 / 3
Quick quiz 3 / 3
What to remember
- Next.js is a React framework that organises routing, rendering, data and the production build.
- In the App Router, folders under app/ are URL segments and page.tsx is the UI for that URL.
- Components are Server Components by default; only interactive parts are split out with "use client".
- The course has 33 lessons across Basic, Intermediate, Advanced, Projects and Exercises, building Myanmar Notes all the way to deployment.
Next.js — Getting Started — Next.js
Next.js — Getting Started — Next.js