Skip to content

Instantly share code, notes, and snippets.

@ankitghike
Created October 4, 2018 07:14
Show Gist options
  • Save ankitghike/bdadfc6dc86597292f8ed5b1a4479df8 to your computer and use it in GitHub Desktop.
Save ankitghike/bdadfc6dc86597292f8ed5b1a4479df8 to your computer and use it in GitHub Desktop.
class Container extends React.Component {
constructor(props) {
super(props);
this.state = {
friends: []
};
}
componentDidMount() {
FriendsService.fetchFriends().then((data) => {
this.setState({
friends: data
});
});
}
render() {
const { friends } = this.state;
return (
<View style={styles.flex}>
<FriendsHeader count={friends.length} text='My friends' />
{friends.map((friend) => (<FriendRow {...friend} />)) }
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment