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.

Push or replace route with query params

See original GitHub issue

Can I use pushRoute or replaceRoute and specify query parameters via json object?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

3reactions
theshaunecommented, Jan 7, 2019

The Documentation specifies that a URL can be used, however i only seem able to get the it working when i use the route-name as @antiproblemist suggested above.

API:
Router.pushRoute(route)
Router.pushRoute(route, params)
Router.pushRoute(route, params, options)

Arguments:
route - Route name or URL to match
3reactions
antiproblemistcommented, Jan 5, 2019

You can specify query parameters by passing an object in pushRoute or replaceRouter let params = {a: '1', b: '2', c: '3'} Router.pushRoute('routeName', params)

In pushRoute the first paramter will be the name of the route defined in your router file

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I change only specific query params in current ...
Change to $router.replace or $router.push : ... this.route.path will query the current path without any queryString (use this.$route.
Read more >
Programmatic Navigation
It acts like router.push , the only difference is that it navigates without pushing a new history entry, as its name suggests -...
Read more >
Navigate to a URL with Query Strings (Search Params) in ...
React Router has a useSearchParams hook to help us read or update the query string of a route that's active, but it doesn't...
Read more >
router replace params - You.com | The AI Search Engine ...
$router.replace({path: "/user/123", query:{q1: "q1"}}) , but it is easier to supply dynamic params on named routes than composing the route string. But in ......
Read more >
next/router
Similar to the replace prop in next/link , router.replace will prevent adding a new URL entry into the history stack. router.replace(url, as, options)....
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