redux-dispatch-batch-middleware

0.1.2 • Public • Published

redux-dispatch-batch-middleware

Middleware that allows to dispatch an array of actions

Installation

yarn add redux-dispatch-batch-middleware

or (if you are not using Yarn, but hope you do 😉)

npm i redux-dispatch-batch-middleware

Usage

In place where your createStore lives:

import { createStore, applyMiddleware } from 'redux';
import dispatchBatchMiddleware from 'redux-dispatch-batch-middleware';
 
const createStoreWithMiddlewares = applyMiddleware(
    // ... all your middlewares
    dispatchBatchMiddleware,
)(createStore);

and now you can dispatch your actions like this:

dispatch([
    oneAction(),
    anotherOneAction(someArgs),
    andAllOthersThatYouNeed(),
]);

🎉

p.s. And of course you can still dispatch like this:

dispatch(something());

Package Sidebar

Install

npm i redux-dispatch-batch-middleware

Weekly Downloads

2

Version

0.1.2

License

ISC

Last publish

Collaborators

  • ivanzusko