README
Simple batch reducers for https://github.com/developit/unistore
Sample
const store = unistore.createStore({
a: 1,
b: 2
});
const reducers = {
one: (state, add = 1) => ({
a: state.a + add,
b: state.b + add
}),
two: (state, add = 1) => Promise.resolve({
a: state.a + add,
b: state.b + add
}),
three: () => null,
four: () => Promise.resolve(null),
};
batchReducers(store, [
reducers.one, 2
], [
reducers.two, 2
],
reducers.three,
reducers.four
)
.then(state => {
// state === {a: 5, b: 6}
});