Next.js Discord

Discord Forum

Set URL to current url with search params and a new searchparam

Answered
Dwarf Crocodile posted this in #help-forum
Open in Discord
Dwarf CrocodileOP
I want to replace the url in the browser with the current url + the current search params + a new provided search param to effectively use the query parameters as state. I know this is possible using shallow routing in the pages router but i can't find an alternative in the app router.
Answered by Sokoke
Hey @Dwarf Crocodile , I'd recommend trying this library. It'll help you manage your URL state.

https://github.com/47ng/nuqs
View full answer

2 Replies

Sokoke
Hey @Dwarf Crocodile , I'd recommend trying this library. It'll help you manage your URL state.

https://github.com/47ng/nuqs
Answer
Dwarf CrocodileOP
This was exactly what i was looking for thank you