Created
April 6, 2016 14:00
-
-
Save qmmr/6264218d03199c2c00e4ce59c59ab9ef to your computer and use it in GitHub Desktop.
Redux thunkMiddleware in ES5
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
// INFO: ThunkMiddleware | |
var thunkMiddleware = function (store) { | |
return function (next) { | |
return function (action) { | |
if (typeof action === 'function') { | |
action(store.dispatch, store.getState); | |
} | |
return next(action); | |
}; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment