-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Hey @RichardLindhout! I am still very happy with this tiny but powerful library :)
I'd like to listen for state changes to trigger side effects (e.g. logging, tracking). For now I need to this in store.set itself, but I'd like to have this side effect free.
Maybe something along those lines:
const unsubscribe = myRidgeStore.subscribe((prevState, newState) => {
// side effects here
})Unfortunately onSet doesn't suffice as it happens after the state already has changed, I would also be fine with another option at store creation.
But in my opinion the approach I suggested is a little bit more approachable.
Thanks :)
mosch
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request