Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const getUser = axios.get('url'); // promise lang talaga to pag console.log
const handleUserDetails = (userDetails) => {
console.log(userDetails);
// pagka react
this.setState({ user: userDetails });
};
getUser
.then((response) => {
console.log(response.data); // more info https://github.com/axios/axios#response-schema
handleUserDetails(response.data);
})
.catch (error => {
console.log(error.response); // more info https://github.com/axios/axios#response-schema
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment