Capturé
Segments capturés de deeply/nested/path/that/keeps/going.
Astuce
props.params.slug peut arriver soit comme chaîne (avec des séparateurs /) soit comme tableau selon le moteur de rendu — défendez-vous toujours avec Array.isArray(raw) avant de le parcourir.
props.params bruts
| param | value |
|---|---|
| slug | "deeply/nested/path/that/keeps/going" |
Segments (6)
- deeply
- nested
- path
- that
- keeps
- going
// 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>
);
}