Use params on any route
See original GitHub issueHello everyone, I’m using <nuxt-link :to="localePath({ name: 'purchases' params: { slug: 123 } })">Link</nuxt-link>
but it only works when I’m inside the route /purchases/_id. Outside this route on purchases list for example, I have to use localePath('/purchases/' + purchase._id)
, because it don’t add the params to the path.
There’s any way to achieve localePath({ name: 'purchases' params: { slug: 123 } })
with params?
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
useParams v6.6.1 | React Router
The useParams hook returns an object of key/value pairs of the dynamic params from the current URL that were matched by the <Route...
Read more >How to use the useParams hook in React Router - Refine Dev
We'll discover how to access the parameters of the current route with the useParams hook in React Router.
Read more >A Look at React Hooks: useParams for Dynamic Routing
The useParams Hook returns an object of key/value pairs from the current URL's dynamic parameters. As long as the params are matched to...
Read more >Passing parameters to routes - React Navigation
Pass params to a route by putting them in an object as a second parameter to the navigation.navigate function: navigation.navigate('RouteName', { /* params...
Read more >How to Use React Router: useParams | by Megan Lo - Medium
According to the definition in React Router doc, useParams returns: an object of key/value pairs of URL parameters. Use it to access match....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Using paths is less reliable but I think
localePath('/purchases/123')
should work.@rchl I’m just curious, how can I achieve the same result using path, is it possible?