S
SolidJS2y ago
zimo

Can I react/listen on store changes?

I a variable I have been explicitly listening on changes to:
createEffect(on(mySignal, () => {
doThing();
}));
createEffect(on(mySignal, () => {
doThing();
}));
Now I also have a store. But I can't do on([mySignal, myStore], ...) Is there another way?
2 Replies
thetarnav
thetarnav2y ago
store.property to listen to a single property { ...store } to listen to a single object trackStore(store) from solid-primitives to listen to any nested change but generally you track what you use so when you stop using on and instead just use the store in the callback, what gets used will automatically be tracked
zimo
zimoOP2y ago
thanks a lot :D

Did you find this page helpful?