Skip to content

Instantly share code, notes, and snippets.

@hgale
Created March 6, 2018 20:30
Show Gist options
  • Save hgale/25c32e6d3401522e1e25042d989fc38a to your computer and use it in GitHub Desktop.
Save hgale/25c32e6d3401522e1e25042d989fc38a to your computer and use it in GitHub Desktop.
const coinAPIBaseURL = 'https://api.coinmarketcap.com';
componentDidMount() {
return fetch(`${coinAPIBaseURL}/v1/ticker/?limit=10`)
.then(response => response.json())
.then(responseJson => {
this.setState({
loading: false,
coins: responseJson
})
})
.catch(error => {
console.error(error);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment