Replies: 1 comment
-
|
In code-based routing, the The fix: reference the route object directly instead of passing a string. const params = useParams({ from: groupItemRoute.id })This way TypeScript infers the correct params type from the route definition, and you don't have to guess the internal ID format. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using code-based routing with nested routes:
Calling useParams in a component using the path will throw an error:
useParams internally uses the route's id, not its path. When using nested routes, the id is generated based on the parent route's id and the child route's path. Because of this, it becomes impossible to reuse route path constants—you have to either import the route and use its id or search through router.routesByPath. Is this the expected behavior? It would be good if this were mentioned in the documentation
Beta Was this translation helpful? Give feedback.
All reactions