Hi I am new to react and at the moment I want to make simple GET requests to an api but all I get is a Promise <pending>
when I try to console.log it out
I have the following function
let user = axios.get('/api/v1/users/id/' + userid)
.then(response => response.data)
.then( data => { console.log( data ); return data });
console.warn(user);
and it should return a user object and store it in a variable so that I can use it later but it does not work
What have I done wrong here and is there a better way to do this.
Thanks in advance