Redux Delayed Dispatch
Delayed Dispatch is setTimeout/clearTimeout but in middleware form with some small enhancements.
Install and setup
npm install redux-delayed-dispatch
- Add the store enhancer using
applyMiddleware
:
Example:
// import middleware; // use middleware in your store;
Using
For basic actions where the keys and values of the redux action or primitives (excluding object
, array
, and function
)
; const myAction = type: 'ACTION_TYPE' param ; // delays myAction for 100 msconst id cancel = ;if shouldCancelTimer // myAction will not be dispatched ;