Created
October 4, 2018 07:14
-
-
Save ankitghike/bdadfc6dc86597292f8ed5b1a4479df8 to your computer and use it in GitHub Desktop.
This file contains 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
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