Impossible to navigate to route that have any component using setSearchParams in createEffect
Hi, I know this seems not to be the right way to handle state, but could anyone take a look?
https://stackblitz.com/edit/solidjs-templates-v8bqor?file=src%2Froutes%2Fother.tsx
4 Replies
In this case, you don’t need a signal. You can use setSearchParams in the onInput .
It is basically a reactive store which persists its data in the url.
If you use the value e.g. to fetch data, it might make sense to use some kind of debounced value or use just set the value when a button is pressed.
Thanks for the reply, I'm just wondering why it blocks on navigate
I'm in the case that I have a component which needs to conditionally use searchParams to store state or using a normal signal
Like a switching mode one
Any suggestions for this?
Inside your event handler
condition ? setSignal(…) : setSearchParams(…)
?OK, i'll give it a try, thanks