Dynamic route parameters
A dynamic route segment matches a variable part of the URL. A folder named [slug] captures that part as a parameter. A slug is an application-defined text identifier, such as moss. The modern App Router page receives params asynchronously.
Scope: Next.js 16.x candidate, App Router only, Cache Components disabled, TypeScript unless otherwise labeled. Examples are static source walkthroughs; exact framework patch and build are not verified.
app/catalog/[slug]/page.tsx (first version)
export default async function BookPage({ params }: { params: Promise<{ slug: string }>;}) { const { slug } = await params; return <main><h1>Book: {slug}</h1></main>;}/catalog/moss produces the heading Book: moss. /catalog/harbor produces Book: harbor. This first version only displays a captured parameter; it does not prove a book exists.
A parameter is not a record
A bracket folder matches one segment. The property name comes from the bracket name, not the component name. Next.js 16 teaching examples await params; older synchronous examples are migration material. The type tells TypeScript which property to expect, not whether an identifier exists or whether a user may access it.
A nested dynamic path (partial route tree)
app/collections/[collection]/books/[slug]/page.tsxURL: /collections/nature/books/mossExpected params: { collection: "nature", slug: "moss" }An awaited params object has both named path segments. A separate query such as ?view=compact does not become a path parameter.
Common mistake
Do not read params.slug directly from the Promise, and do not treat a user-controlled slug as a trusted filesystem path. Use a validated record lookup.
Try it yourself
Predict params for /catalog/harbor?view=compact. Then rename the folder to [bookId] and explain which property must change.
After this lesson, you should be able to: Read asynchronous params; Map a known slug to content.