Skip to content

Instantly share code, notes, and snippets.

@DominicGBauer
Created February 10, 2019 13:01
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save DominicGBauer/a4f43e9936e79562966a4897d69ae832 to your computer and use it in GitHub Desktop.
// 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