Caught

Segments captured from foo.

Tip
props.params.slug may arrive as a string (with / separators) or as an array depending on the renderer — always guard with Array.isArray(raw) before iterating.

Raw props.params

paramvalue
slug"foo"

Segments (1)

  1. foo
src/app/examples/catch/[...slug]/page.tsxTSX
// props.params.slug holds every segment after the prefix,
 // joined by "/" — split it to get an array.
export default function Page(props: PageProps): any {
    const raw = props.params.slug;
    const segments = Array.isArray(raw)
        ? raw
        : String(raw).split("/").filter(Boolean);
    return (
        <ol>
            {segments.map((s) => <li>{s}</li>)}
        </ol>
    );
}

← back to the catch-all index