Redux store enhancer to allow batched dispatch.
yarn:
yarn add redux-batched-dispatch
npm:
npm install --save redux-batched-dispatch
import reduxBatchedDispatch from 'redux-batched-dispatch';
import { createStore } from 'redux';
const store = createStore(reducer, reduxBatchedDispatch());
// Batched dispatch will notify to listeners only once after store updated
store.dispatch([
{ type: 'Hello' },
{ type: 'World' },
]);
You can use extra middlewares like redux-thunk, redux-saga, redux-observable, etc..
import reduxBatchedDispatch from 'redux-batched-dispatch';
import { createStore, applyMiddleware } from 'redux';
const store = createStore(
reducer,
reduxBatchedDispatch(applyMiddleware(exampleMiddleware))
);
import reduxBatchedDispatch from 'redux-batched-dispatch';
const reduxBatchedDispatch = require('redux-batched-dispatch');
Add below <script>
tag to the HTML page right before the closing </body>
tag
<script src="https://unpkg.com/redux-batched-dispatch@0.3/dist/index.js" crossorigin></script>
And use global reduxBatchedDispatch
variable