redux-batch-middleware
v0.2.0
Published
Batch redux actions
Downloads
14,171
Readme
redux-batch-middleware
Batch Redux actions
Batch middleware for Redux. Inspired by redux-batched-actions.
Install
npm install --save redux-batch-middleware
Usage
Add as middleware:
import { applyMiddleware, createStore } from 'redux';
import { batch, batching } from 'redux-batch-actions';
import reducers from './reducers';
const middleware = [batch];
const store = applyMiddleware(...middleware)(createStore)(batching(reducers));
Dispatch multiple actions:
store.dispatch([action1, action2]);
API
batch
Redux middleware which converts a dispatched array of actions to a batch action.
batching(reducer)
reducer
Type: function
A reducer that should be able to handle batched actions, most likely the root reducer.
type
The name of the batch type.
License
MIT