Skip to content

Instantly share code, notes, and snippets.

@joedski
Created May 28, 2017 20:54
Show Gist options
  • Save joedski/c51d3b0e0a58ac1c28f7e9da06c02576 to your computer and use it in GitHub Desktop.
Save joedski/c51d3b0e0a58ac1c28f7e9da06c02576 to your computer and use it in GitHub Desktop.
Javascript: Redux: Dispatching Multiple Actions: Custom Middleware Array Edition
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