question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use params on any route

See original GitHub issue

Hello 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:closed
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
rchlcommented, Aug 29, 2020

Using paths is less reliable but I think localePath('/purchases/123') should work.

0reactions
VictorCamargocommented, Aug 29, 2020

@rchl I’m just curious, how can I achieve the same result using path, is it possible?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found