Skip to content

Instantly share code, notes, and snippets.

@CharlesMangwa
Last active March 15, 2018 19:41
Show Gist options
  • Save CharlesMangwa/f8cf2df4ae6b6a87df1f74ec6806b807 to your computer and use it in GitHub Desktop.
Save CharlesMangwa/f8cf2df4ae6b6a87df1f74ec6806b807 to your computer and use it in GitHub Desktop.
React Data Fetching - Fetching data from Redux store
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