Created
May 28, 2017 20:54
-
-
Save joedski/c51d3b0e0a58ac1c28f7e9da06c02576 to your computer and use it in GitHub Desktop.
Javascript: Redux: Dispatching Multiple Actions: Custom Middleware Array Edition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const multiActionMiddleware = store => next => action => { | |
if (!Array.isArray(action)) return next(action); | |
return action.map(a => store.dispatch(a)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment