const fetch = url => dispatch => {
// ...
}
export const fetchQuestions = tag => (dispatch) => {
return dispatch(fetch(tag));
};
What
This is equivalent to one function returning another. I.e. this
const fetch = url => dispatch => {
// ...
}
is equivalent to
const fetch = function(url) {
return function(dispatch) {
// ...
}
}
Similarly this
export const fetchQuestions = tag => (dispatch) => {
return dispatch(fetch(tag));
};
is equivalent to
export const fetchQuestions = function(tag) {
return function(dispatch) {
return dispatch(fetch(tag));
}
};