on-internet
← Community

Displaying FlatList using array of objects (React Native)

Stack Overflow ·

I have a prop where console.log(this.props.userList); returns Array [ Object { "userData": Object { "userName": "David", "userAge": 20, }, "id": "ax3", }, Object { "userData": Object { "userName": "Phillip", "userAge": 27, }, "id": "xq4", }, Object { "userData": Object { "userName": "Kelly", "userAge": 28, }, "id": "pj7" } ] I am trying to generate a Flatlist from that data by writing: <FlatList data={this.props.userList} keyExtractor={item => item.id} renderItem={({ item }) => <Text>{item.userData.userName}</Text> } /> When testing through Expo on my iPhone, the app just freezes. It does not

Comments

Sign in or sign up to comment and upvote.

No comments yet.