Skip to content

Instantly share code, notes, and snippets.

@CharlesMangwa
Last active March 15, 2018 19:41
Show Gist options
  • Save CharlesMangwa/f86b98f84b88c7407dbb8ba95f2ad47e to your computer and use it in GitHub Desktop.
Save CharlesMangwa/f86b98f84b88c7407dbb8ba95f2ad47e to your computer and use it in GitHub Desktop.
React Data Fetching - A bit more complex use case
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