Chained Arrow function syntax

后端 未结 4 1266
野的像风
野的像风 2021-02-19 20:08
const fetch = url => dispatch => {
  // ...
}

export const fetchQuestions = tag => (dispatch) => {
  return dispatch(fetch(tag));
};

What

4条回答
  •  梦毁少年i
    2021-02-19 20:45

    dispatch is the first and single parameter of the function returned by the url => ... function. With normal function syntax, it would be

    const fetch = function(url) {
        return function(dispatch) {...}
    }
    

提交回复
热议问题