{multiList.map((item,index)=>
<View style={{ flexDirection: "row" }}>
<TouchableOpacity
onPress={() => {}}
style={styles.GridViewBlockStyle}
>
<Text style={styles.GridViewInsideTextItemStyle}>
{item.key}
</Text>
</TouchableOpacity>
</View>
)}
error Warning: Each child in a list should have a unique "key" pro
CodePudding user response:
You needed to supply a key (a prop called 'key') to the component you are rendering.
<View
key={index}
CodePudding user response:
try this,
{multiList.map((item,index)=>
<View key={index} style={{ flexDirection: "row" }}> // pass unique key here
<TouchableOpacity
onPress={() => {}}
style={styles.GridViewBlockStyle}
>
<Text style={styles.GridViewInsideTextItemStyle}>
{item.key}
</Text>
</TouchableOpacity>
</View>
)}