simple-js-state
v0.1.4
Published
Simple State Machine
Downloads
2
Readme
State Machine
Based on https://github.com/andybelldesign/beedle which is based on this article https://css-tricks.com/build-a-state-management-system-with-vanilla-javascript/
Publish state change
import store from './store/index.js';
store.dispatch('addItem', 'A new item');
Subscribe to state change
import store from './store/index.js';
constructor() {
store.subscribe('stateChange', () => this.render());
}
render = () => {
console.log(store.state.items);
/**
Compare to local state and update/re-render if necessary
*/
}