I need help with rendering nested JSON inside my JSX. Below is the JSON response:
[{
"data": {
"total_students": 13,
"seats": "",
"categories": [{
"id": 28,
"name": "Economy",
"slug": "economy",
}],
"instructor": {
"id": "24",
"name": "Ad",
"sub": ""
},
"menu_order": 0
},
"headers": [],
"status": 200
}
This is how the response looks like. In order to render it in React, you can use the following code:
return this.state.user.map(user =>
<CardSection>
<View style={styles.thumbnailContainerStyle}>
<Text key= {user.data.name} style={styles.userStyle}>{this.state.user.data}</Text>
</View>
</CardSection>
I have attempted the above approach but encountered an error during rendering: cannot define name of undefined
. Can someone please assist me in figuring out what I am doing wrong?