Last active
September 16, 2021 02:34
-
-
Save nuintun/87d03b6ed04325ad28fe9a9c5538a879 to your computer and use it in GitHub Desktop.
redux-compose 实现
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
/** | |
* @function compose | |
* @description compose redux middlewares | |
* @param {function[]} funcs | |
* @returns {function} | |
*/ | |
function compose(middlewares) { | |
return middlewares.reduce((compose, middleware) => { | |
return (...args) => compose(middleware(...args)); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment