Next.js Discord

Discord Forum

Synchronizing State, Input value and url params

Answered
XtratoS posted this in #help-forum
Open in Discord
I'd like to fetch some data based on url params on initial page load,
Then I want to fetch this data again as well as changing url search param whenever I change some input field value then press enter,

I've sort of gotten me head around it, but I'd like to ask if there's a way to do this using server actions, since the form is a sibling to 3 other components which need to access the result of the form submission (the result of the server action)

How would I do this?
Answered by B33fb0n3
Youo can use this package to directly update, debounce, ... your url: https://nuqs.47ng.com/
View full answer

6 Replies

Answer
@XtratoS The page flashes when I change the parameter
Can you please create a minimal reproduction. Dont share company details. Use either jsfiddle or https://codesandbox.io/
@XtratoS will you provide a repro?
I won't be able to with shit my code was, will rewrite the whole thing again