TanStackT
TanStack6mo ago
22 replies
foolish-indigo

Optional path params with groups

Is it possible to use optional path params with route groups so that I don’t have to repeat the param in every route path?

In the file based example i tried moving about.tsx into a ({-$locale}) similar to the advanced i18n with route groups example, but it's not matching /test/about like it does when the folder is named {-$locale}.

Am I misunderstanding how ({-$locale}) works in route groups?
Path params are used to match a single segment (the text until the next /) and provide its value back to you as a named variable. They are defined by using the $ character prefix in the path, followed...
Path Params | TanStack Router React Docs
Was this page helpful?