Next.js App Router and routing

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/20

encourage image

There's no tags or description

Looks like no tags are added yet.

21 Terms

1
New cards
2
New cards
3
New cards
4
New cards
5
New cards
What is Next.js?
A React framework for full-stack apps.
6
New cards
In the App Router, which file maps to the / route?
app/page.js
7
New cards
In the App Router, which file maps to the /books route?
app/books/page.js
8
New cards
What do folders represent in the App Router?
URL segments.
9
New cards
What does page.js do?
It makes the route renderable (publicly accessible).
10
New cards
What does app/layout.js do?
It wraps child pages and receives children.
11
New cards
Which URL does app/books/[id]/page.js match?
/books/42 (any value in the id position).
12
New cards
How do the slides read the id in a dynamic route page?
The page is async: async function Page({ params }) { const { id } = await params; }
13
New cards
Why is the page function async when reading params?
In the slide examples, params must be awaited.
14
New cards
What does [...slug] match?
One or more segments (a catch-all). It does not match the base path.
15
New cards
What does [[...slug]] match?
One or more segments, and also the base path (optional catch-all).
16
New cards
What is the difference between [...slug] and [[...slug]]?
Double brackets also match the base path with no segments.
17
New cards
Which component handles client-side navigation in Next.js?
Link from next/link.
18
New cards
What does loading.js do?
It supplies the loading UI.
19
New cards
What does error.js do?
It acts as an error boundary and supplies the error UI.
20
New cards
What must error.js include at the top?
"use client"
21
New cards
What does not-found.js do?
It supplies the not-found UI.