Answer the question
In order to leave comments, you need to log in
Is return necessary in ES6 syntax?
Need help understanding es6
Arrow functions have the option not to write return
export const receive = () => ({
type: actions.SET
})
export const onSubmit = (data, token) => {
axios.defaults.headers.common['Authorization'] = token;
return dispatch => (
axios.post(apiUrl + '/pss', data)
.then(res => {
if (res.data !== null) dispatch(onSubmitSuccess())
else return { type: psActions.ON_SUBMIT_ERROR }
})
)
}
Answer the question
In order to leave comments, you need to log in
What's the problem. 1 line - return is not needed. A lot, write explicitly return. Or is it hard to press 6 keys? Do you write code for yourself or for those who will then dance with a tambourine?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question