Redux compose
读的比较好的一篇文章:
https://www.jianshu.com/p/c9d...
export default function compose(...funcs) {
if (funcs.length === 0) {
return arg => arg
}
if (funcs.length === 1) {
return funcs[0]
}
return funcs.reduce((a, b) => (...args) => a(b(...args)))
}
compose(f1, f2, f3, f4)(args)
执行顺序是 : f1(f2(f3(f4(args))))
转载自:https://segmentfault.com/a/1190000042008474