I have the following return code
return (
<FlatList
data={data.groupQuery.entities}
keyExtractor={(item, index) => index}
renderItem={
({ item }) => {
return (
<View style={styles.container}>
/>
<Text style={styles.label}>Name: {item.fieldName}</Text> // I want to display fieldName value here
</View>
)
}
}
/>
);
Given the above, how can I access the fieldName values from the query array in the photo. I want to call the field dynamically.
Updated query:
Apologies for some confusion to this thread. Now my goal is to access the fieldName value from the photo below. I tried {item.fieldTradingPlatform.entity.fieldName} but getting TypeError: Cannot read property 'fieldName' of undefined
Previous query:
With static call, I can output the value of first array:
console.log(data.groupQuery.entities[0].fieldName)


{item.fieldName}outputs thefieldName. 2> This updated version of my query. So I want to know how to dynamically call the values.FlatListcomponent already dynamically creates a view for each item in the array of items you pass to thedataprop. The value of each item is available inside therenderItemfunction. You're already dynamically rendering some views based on the passed-in array. If you have two items in your array, a separate view should be rendered for each of those items.