Last active
November 22, 2019 22:50
-
-
Save jcunanan05/6b8f5cc707ddb296a5ea07668f6a0341 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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