State Management is surely one of the most delicate aspects of building sizable Web Applications.
Yet I think most of the state managers out there tend to overdo it, so I tried my hand at it with two goals in mind:
- it should only do what's absolutely needed
- it should be as small as possible
init(initialState)
: create the store with an initial statestore.getState()
: returns the current state of the storestore.setState(newState)
: sets the state of the store to newStatestore.subscribe(callback)
: will call the callback on state changes