【发布时间】:2017-08-26 17:12:31
【问题描述】:
看着real world example我看到这个设置api中间件:
export default store => next => action => {
const callAPI = action[CALL_API]
if (typeof callAPI === 'undefined') {
return next(action)
}
这里到底发生了什么?我看到 configureStore 正在导入任何内容并将其从 redux 传递给 applyMiddleware,但是这种语句在 js 中意味着什么?
我假设它正在导出一个返回函数的匿名函数?刚刚试过这个:
var a = b => c => d => {
console.log('a:', a);
console.log('b:', b);
console.log('c:', c);
console.log('d:', d);
};
a(5)(6)(7);
// outputs b: 5, c: 6, and d: 7
【问题讨论】:
标签: redux