Come back to this a few days after finishing the course. Try everything without looking back at earlier lessons first.
Bug hunt
This Study Notes app has four bugs, from Days 3, 4, 5 and 6. Try these, in order, and note what goes wrong each time:
- Go to Settings, then back to Notes. Watch how the list appears.
- Open any note.
- New note: type a title only, and press Save note.
- Settings: press Dark.
Runs with real Next.js on your computer: unzip, then
npm install and npm run dev. Hint 1: what you should have seen
- Nothing changes for over a second, then the list and the stats appear together.
- No such note, for a note that's right there in the list.
- Write the note itself. appears, but the title you typed is gone.
- The theme stays light, and Settings still says Theme: light.
Hint 2: where to look
How app/page.jsx renders NoteStats; how app/notes/[id]/page.jsx reads
params; what addNote returns on an error; and the cookie's name in
saveTheme compared with the layout.
Show the four bugs and the fixed app
- The slow stats aren't in a boundary (Day 4). The whole page waits for
them. Wrap
<NoteStats />in<Suspense>with a fallback, so the list shows first. paramsisn't awaited (Day 3).const { id } = params;reads from a promise, soidisundefined, no note is found, and the page callsnotFound(). Useawait params. The console says so too:paramsis a Promise and must be unwrapped withawait.- The error result drops the values (Day 5).
addNotereturns empty values with its errors, so the form'sdefaultValues are empty. Return the values that were sent. - The cookie has two names (Day 6).
saveThemesetscolour-theme, but the layout and Settings readtheme. Use one name.
Runs with real Next.js on your computer: unzip, then
npm install and npm run dev. Recall questions
Answer each in a sentence or two, then check the lesson it came from.
- Which files does Next.js treat specially in a folder, and what does each do? (Days 1 and 4)
- When must a component be a client component? (Day 2)
- Why must a client component read
windowin an effect, on real Next.js? (Day 2) - How does a page read
/notes/2's2, and?tag=data'sdata? (Day 3) - What's the difference between
router.pushandrouter.replace? (Day 3) - Why does
reset()alone not fix an error from server data? (Day 4) - What does
revalidatePathdo after a server action? (Day 5) - Why does a server action check its input even when the form uses
required? (Day 5) - When would you write a route handler instead of a server action? (Day 6)
Ready for the next step?
You're ready to move on if you can, without help:
- lay out a multi-page site with layouts, links and not-found pages
- split a page into server components for data and client components for interaction
- build pages from URL segments and search params
- show loading states, stream slow parts and handle errors
- save data with validated server actions
- write a small JSON API, use a cookie, and give pages titles
- run, build and explain a Next.js app on your own computer
If one of these feels shaky, redo that day's checkpoint from scratch.
Completion is saved in this browser only. It does not measure mastery.