Add query params to current url
See original GitHub issueI want to add query param to current url, I don’t know what current url is.
For example I have /token/ETH
or /user/user1
urls and want to change they to /token/ETH?m=ref
or /user/user1?m=ref
accordingly.
Is it possible to define an action only for updating query in URL?
Will appreciate any help
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to add url parameter to the current url? - Stack Overflow
There is no way to write a relative URI that preserves the existing query string while adding additional parameters to it. You have...
Read more >How to Get and Set Query Parameters From URL - getButterfly
Here are two ways to get (and set) query parameters from URL. ... Construct URLSearchParams object instance from current URL querystring let ...
Read more >Php: Replace or add query parameter to the current url
phpReplace or add query parameter to the current url. $url = parse_url($_SERVER['REQUEST_URI']); parse_str($url['query'], $q); $params = ['a' => 1, ...
Read more >URLSearchParams.append() - Web APIs - MDN Web Docs
URLSearchParams.append(). The append() method of the URLSearchParams interface appends a specified key/value pair as a new search parameter.
Read more >Angular Basics: Using Query Params in Angular Routing
See the query parameters from search and other queries too merged with the “&” character. Angular makes it easy for us to create...
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
The current route action is available in the
location
reducer, so its quite simple to write a thunk which copies the current route action, changes some part of it, and dispatches it.I know it’s closed but closed issues are still useful when people are looking for solutions, right? In case it’s useful for someone else…
This is my higher order component (using recompose and connect) that adds a function prop named
queryUpdate
to any component that will dispatch an action to update the query without a route change. You could modify to create a react hook or a HOC without recompose.