Redux-Leaves: bundling actions
const { createStore } = require('redux')
const { reduxLeaves, bundle } = require('redux-leaves')
const initialState = {
list: ['a', 'b'],
nested: {
counter: 0,
state: {
deep: 'somewhat'
}
}
}
const [reducer, actions] = reduxLeaves(initialState)
const store = createStore(reducer)
store.getState()
const actionBundle = bundle([
actions.list.create.push('c'),
actions.nested.counter.create.increment(5),
actions.nested.state.create.set('arbitrary', true)
])
store.dispatch(actionBundle)
store.getState()
no comments