search params with # on URL is not working
Answered
fran posted this in #help-forum
franOP
hello, I am trying to navigate to a URL like the following example: https://example.com/path1#idrandom?testParam=test, when I use the hashtag to scroll to an element, the search params are not applied, is it a bug or am I doing something wrong?
Answered by Ray
query params should go first
https://example.com/path1?testParam=test#idrandom
https://example.com/path1?testParam=test#idrandom
12 Replies
@fran hello, I am trying to navigate to a URL like the following example: https://example.com/path1#idrandom?testParam=test, when I use the hashtag to scroll to an element, the search params are not applied, is it a bug or am I doing something wrong?
because its hash, you could access it with
window.location.hashfranOP
yeah, but i want to access to the searchParams
not hash
@fran yeah, but i want to access to the searchParams
how do you access the searchParams?
franOP
useSearchParams
or in page with the prop searchParams
@fran or in page with the prop searchParams
query params should go first
https://example.com/path1?testParam=test#idrandom
https://example.com/path1?testParam=test#idrandom
Answer
the url include the search params part and everything after
# is client side@fran thank you!
no prob