Synchronizing State, Input value and url params
Answered
XtratoS posted this in #help-forum
XtratoSOP
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?
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/
6 Replies
XtratoSOP
@XtratoS 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?
Youo can use this package to directly update, debounce, ... your url: https://nuqs.47ng.com/
Answer
@B33fb0n3 Youo can use this package to directly update, debounce, ... your url: https://nuqs.47ng.com/
XtratoSOP
The page flashes when I change the parameter
@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?
XtratoSOP
I won't be able to with shit my code was, will rewrite the whole thing again