Next.js Discord

Discord Forum

Get complete URL with Params client-side

Unanswered
Welsh Sheepdog posted this in #help-forum
Open in Discord
Welsh SheepdogOP
In next 12 I used to be able to get the full url including all paeans client side eg

example.com/folder/page?param1=124&param2=123

This doesn’t seem to work anymore with the new router and I am confused as to how I can make this work, checked the docs but I can’t find anything?

2 Replies

Welsh SheepdogOP
Nobody?
You have to conpose it yourself with usePathname and useSearchParams.

See: https://nextjs.org/docs/app/api-reference/functions/use-router#migrating-from-nextrouter