Last active
March 15, 2018 19:41
-
-
Save CharlesMangwa/f8cf2df4ae6b6a87df1f74ec6806b807 to your computer and use it in GitHub Desktop.
React Data Fetching - Fetching data from Redux store
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 { Image, View, Text } from 'react-native' | |
import { Fetch } from 'react-data-fetching' | |
export default class Container extends Component { | |
render() { | |
return ( | |
<Fetch path="store"> | |
{({ data }) => ( | |
<View> | |
<Image source={{ uri: data.user.avatarUrl }} /> | |
<Text>Hello {data.user.firstName}</Text> | |
<Text>Friends: {data.user.friends.length} to this day!</Text> | |
</View> | |
)} | |
</Fetch> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment