File conventions

Catch-all and optional catch-all

Required catch-all captures one or more segments as string[]. Optional also matches the parent URL, where the value is undefined. These are alternative routes, not simultaneous declarations. Source: https://nextjs.org/docs/app/api-reference/file-conventions/dynamic-routes. Draft; examples are illustrative snippets, not complete runnable programs.

Formal Syntax & Structure

nextjs syntaxnextjs
app/guide/[...parts]/page.tsx or app/guide/[[...parts]]/page.tsx

Working Example

Example Snippetnextjs
const { parts } = await params;const trail = parts ?? [];
Next.js Reference