hookrouter
hookrouter copied to clipboard
navigate() does not keep queryparameter even with fourth argument set to false
navigate("/authentication?test=true",false,{a:false},false);
only ?a=false
will be appended
Hey, @alex-frx I am navigating using navigate api. The URL is changing but the page is not heading to a new page. Why is it happening?
@khushal87 im not associated with the project but maybe i can help. open a new issues that is related to your question and include your component that redirects and your routes
This issue is also relevant for the use of the A element in this package.
I suspect that the call to navigate in https://github.com/Paratron/hookrouter/blob/e0ceb4a6ed495a59754351aff6ad54ce5c124512/src/Link.js#L24 should be changed into something like this:
let params = {}
if(e.currentTarget.href.indexOf("?")>-1) {
params = Object.fromEntries(new URLSearchParams(e.currentTarget.href.split( "?")[1]))
}
navigate(e.currentTarget.href, false, params, false)`