I'm getting a weird warning that I'm Expected to return a value in arrow function
in the following code
export const loginUser = userData => dispatch => {
axios.get("http://localhost:5000/users")
.then((res)=>{
res.data.map(user => { <---- warning occurs here
if(user.email === userData.email){
if(user.password === userData.password){
localStorage.setItem("user", JSON.stringify(user));
dispatch(setCurrentUser(user));
}
}
})
})
.catch((err)=>dispatch({
type: GET_ERRORS,
payload: err.data
}))
}
But I thought it was not required to declare an explicit return
in an arrow function, what am I doing wrong? How can I fix this?