Next.js Discord

Discord Forum

search params with # on URL is not working

Answered
fran posted this in #help-forum
Open in Discord
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?

12 Replies

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?
useSearchParams
or in page with the prop searchParams
Answer
the url include the search params part and everything after # is client side
ohhhh, i thought it was first the id
its working now!
thank you!
@fran thank you!
no prob