Skip to content

Instantly share code, notes, and snippets.

@benthehenten
Last active April 27, 2017 21:03
Show Gist options
  • Save benthehenten/cb440ba7dd720593cd22cf274b10a38f to your computer and use it in GitHub Desktop.
Save benthehenten/cb440ba7dd720593cd22cf274b10a38f to your computer and use it in GitHub Desktop.
class DataView extends Component {
state = {
data: null,
}
async componentDidMount() {
this.fetchData()
}
fetchData = async () => {
const res = await fetch('https://api.apphub.io/');
const json = await res.json()
this.setState({
data: json.data
})
}
render() {
return <div>{this.state.data}</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment