Last active
March 15, 2018 19:41
-
-
Save CharlesMangwa/f86b98f84b88c7407dbb8ba95f2ad47e to your computer and use it in GitHub Desktop.
React Data Fetching - A bit more complex 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 { View, Text } from 'react-native' | |
import { Fetch } from 'react-data-fetching' | |
export default class Container extends Component { | |
render() { | |
return ( | |
<Fetch | |
url="https://api.nyan.com/cats/squad" | |
method="POST" | |
headers={{ | |
'X-Nyan-Token': 'superNyan' | |
}} | |
body={{ | |
name: 'NyanCatAlpha', | |
isAwesome: true, | |
}} | |
> | |
{({ data }) => ( | |
<View> | |
<Text>{data.name}</Text> | |
</View> | |
)} | |
</Fetch> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment