Path Params in Middle Of Route?
Can a path param be used like so: /route1/$var/add
parseParams returns type error: Property '$var' does not exist on type 'Record<never, string>'.ts(2339)
or should I be using a different route structure? My use case is four tabs used to filter a table by the $var value and provide CRUD functions for each. They use the same database table but different form fields with some overlapping fields.
1 Reply
vicious-goldOP•16mo ago
Found my answer in the doc 🙂 Linking for reference: https://tanstack.com/router/latest/docs/framework/react/guide/path-params#path-params-can-be-used-by-child-routes
Path Params | TanStack Router React Docs
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 by the key variable to assign it to. The following are valid path param paths:
$postId