Nextjs Fundamentals · App Router

Dynamic route segments

`[slug]` and async `params`

Dynamic route segments

A dynamic segment lets one route file generate many pages from data. Wrap a folder name in square brackets to create one. For example, app/blog/[slug]/page.tsx matches /blog/hello-world, /blog/second-post, and so on, with slug holding the varying part of the URL.

The page receives the segment values through its params prop. In Next.js 16, params is a Promise, and synchronous access has been removed — you must await it:

// app/blog/[slug]/page.tsx
export default async function BlogPostPage({ params }: { params: Promise<{ slug: string }> }) {
  const { slug } = await params;
  const post = await getPost(slug);

  return <h1>{post.title}</h1>;
}

The page is an async function, await params resolves the segment value, and then you use it to fetch the data for that page. Nested layouts inside the dynamic segment can read the same params prop.

You are about to answer a short quiz on [slug] and async params.

  1. A dynamic route segment is created by wrapping the folder name in ___.
  2. In Next.js 16, the `params` prop is a Promise that must be awaited.
  3. In `app/blog/[slug]/page.tsx`, the page awaits `params` to read the ___ value.
  4. In Next.js 16, a page can still read `params.slug` synchronously.
  5. One dynamic segment route file can generate many pages from data.