Optional Catch-All
Unanswered
oswald posted this in #help-forum
oswaldOP
When using an optional catch all ([[...sign-in]]), it gives me this error, though in the docs it says it's perfectly fine to use this syntax.
Error: Segment names may not start or end with extra brackets ('[...sign-up').
Catch-all Segments can be made optional by including the parameter in double square brackets: [[...folderName]].
For example, app/shop/[[...slug]]/page.js will also match /shop, in addition to /shop/clothes, /shop/clothes/tops, /shop/clothes/tops/t-shirts.
The difference between catch-all and optional catch-all segments is that with optional, the route without the parameter is also matched (/shop in the example above).
Route Example URL params
app/shop/[[...slug]]/page.js /shop { slug: undefined }
app/shop/[[...slug]]/page.js /shop/a { slug: ['a'] }
app/shop/[[...slug]]/page.js /shop/a/b { slug: ['a', 'b'] }
app/shop/[[...slug]]/page.js /shop/a/b/c { slug: ['a', 'b', 'c'] }
2 Replies
African Slender-snouted Crocodile
Any chance your directory is
[[...sign-up]
with only one trailing bracket?oswaldOP
no, it's two