Created
February 10, 2019 13:01
Star
You must be signed in to star a gist
This file contains 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
// We're creating a function to handle retrieving | |
// the image from the NASA API | |
// Function is asynchronous because talking to the API | |
// isn't instantaneous (your bartender can't instantly | |
// give you your drink when you ask him for it) | |
handlePic = async () => { | |
// Create a response variable that retrieves the data | |
const response = await nasa.get() | |
// Change the state of picture to be the hdurl | |
this.setState({ | |
picture: response.data.hdurl | |
}) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment