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.

Removing extra params from routes

See original GitHub issue

Sorry to use GH as support board but I’ve been dealing with this problems for hours now.

Lets say I have something like:

<Link
  route="my-route"
  params={{ slug: item.slug, id: item.id }}
  passHref
>
...

.add('my-route', '/my-route/:slug/', 'my-route/XYZ')

What is the correct way to remove item.id from on the final route? On my case it will render something like http://0.0.0.0:4000/my-route/nice-slug/?id=26 I dont want to display ?id=26

Any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
MHwishescommented, Oct 18, 2018

I have the same question

1reaction
fridayscommented, Feb 28, 2019

Glad to hear you got it working. Another way would be to keep the id in the url with a route like /my-route/:id/:slug. Depending on the database system and indexing, it can be faster to lookup by id.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 5 remove query param - Stack Overflow
You can remove a query parameter by using the merge option of queryParamsHandling and passing in null for any params you wish to...
Read more >
Provide a way to remove specific parameter from query string
When you remove it then the corresponding parameter should be removed from the query string. Currently you can add new query parameter by:....
Read more >
How to remove query params using React router | bobbyhadz
To remove query params using React router, use the `useSearchParams` hook to get the current location's search params. Use the `delete()` method to...
Read more >
How to remove parameters from url - Laracasts
A regular query string doesn't need any extra parameters in the route if its a get route. Just pass in the URL. Then...
Read more >
Router options - router5
There are two ways to deal with not found routes: the first one is to configure a defaultRoute (and defaultParams ), the second...
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