Last active
March 15, 2018 19:41
-
-
Save CharlesMangwa/85fd6eaee26e526f9d78ff4c8debd8a4 to your computer and use it in GitHub Desktop.
React Data Fetching - Basic use case
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
import React, { Component } from 'react' | |
import { Fetch } from 'react-data-fetching' | |
export default class App extends Component { | |
render() { | |
return ( | |
<Fetch | |
url="https://api.github.com/users/octocat" | |
> | |
{({ data }) => ( | |
<div> | |
<h1>Username</h1> | |
<p>{data.name}</p> | |
</div> | |
)} | |
</Fetch> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment