gpt4 book ai didi

javascript - 两个肥箭相随

转载 作者:行者123 更新时间:2023-11-29 21:26:20 27 4
gpt4 key购买 nike

<分区>

那么这些粗箭头在下面的代码中做了什么?如果他们不是两个我能理解!

export default function clientMiddleware(client) {
return ({dispatch, getState}) => {
// ******** starts here **********
return next => action => {
// ******** ends here **********
if (typeof action === 'function') {
return action(dispatch, getState);
}

const { promise, types, ...rest } = action; // eslint-disable-line no-redeclare
if (!promise) {
return next(action);
}

const [REQUEST, SUCCESS, FAILURE] = types;
next({...rest, type: REQUEST});

const actionPromise = promise(client);
actionPromise.then(
(result) => next({...rest, result, type: SUCCESS}),
(error) => next({...rest, error, type: FAILURE})
).catch((error)=> {
console.error('MIDDLEWARE ERROR:', error);
next({...rest, error, type: FAILURE});
});

return actionPromise;
};
};
}

这段代码的等价物是什么?

value => value2 => {
// some code
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com