1
When I call the Controller Method to list users, instead of returning me the array it returns me the print of the function
Controller code:
export default userController = { Listar: () => { axios.get('http://localhost:8000/user').then(function(resposta){ return resposta.data; }) } }
Giving the console.log to see the return:
componentDidMount(){ console.log(userController.Listar()); }
Will someone please tell me why?
I was able to solve the problem by giving a Return before Axios.get
return axios.get('http://localhost:8000/user').then(function(resposta){
 return resposta.data;
 })
– CJuniorJR
Ahh yes make sense, I sent this example which is like an async/await but a Generator function that also makes a return. I advise to make a Try/catch in case this request fails. Hugs!
– Daniel Obara