How to subscribe a signal using createEffect?
I have a code like this.
I want to change v2 value to 0 if v1 value get changed.
How to make this using createEffect?
9 Replies
You can use the
on
function to subscribe to certain signals
https://www.solidjs.com/docs/latest/api#onSolidJS
Solid is a purely reactive library. It was designed from the ground up with a reactive core. It's influenced by reactive principles developed by previous libraries.
Oh thanks..I thought this kind of approach..
That works too
Yes but i didn't like it, it's like Svelte style..
well that's why there is the
on
function to make it more explicitBut 'on' doesn't work if I use store like this..
() => myStore.v1
Ah ok. I should pass function