Chained Arrow function syntax

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

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

What

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-19 20:53

    fetch is a named function expression that takes a url parameter and returns a new function that takes a dispatch parameter.

    You could rewrite using traditional function syntax:

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

提交回复
热议问题