0.2.0 • Published 8 years ago

redux-batch-middleware v0.2.0

Weekly downloads
1,683
License
MIT
Repository
github
Last release
8 years ago

redux-batch-middleware

Batch Redux actions

npm version

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