我试图理解 redux 中的 thunk:
const thunk = ({ dispatch, getState }) => next => action => {
if (typeof action === 'function') {
return action(dispatch);
}
return next(action);
};
而且我无法理解为什么将参数作为对象传递(或者它是对象解构?)。为什么他们不只是被传递为dispatch, getState
?