这是redux的compose函数源码:export default function compose(...funcs) { if (funcs.length === 0) { return arg => arg
} if (funcs.length === 1) { return funcs[0]
} const last = funcs[funcs.length - 1] const rest = funcs.slice(0, -1)
return (...args) => rest.reduceRight((composed, f) => f(composed), last(...args))
}不明白最后一行: (composed, f) => f(composed), last(...args) 的箭头函数中的返回语句中用逗号分隔f(composed)和last(...args),这里是怎么执行的?谢谢。
添加回答
举报
0/150
提交
取消