A tiny module for managing state.
npm install send-action
var createStore = require('send-action')
var state = {
items: []
}
var actions = {
setItem: function (state, data) {
state.items.push(data)
return state
}
}
function onChange (state, action) {
// render app
console.log(state, action)
}
var send = createStore({
state: state,
actions: actions,
onChange: onChange
})
send('setItem', { title: 'hi' })
setState
functiononChange
handleronChange
handlerProvider
componentContributions are welcome! Please read the contributing guidelines first.
Help keep this project open and inclusive. Please read and follow the code of conduct
Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.