如何解析 React Native 中的子项?

How to parse child item in react native?

<View style={{ flexDirection: 'row' }}>
<AntDesign name="flag" size={12} color="black" style={{ marginTop: 3, marginRight: 10 }} />
<Text style={styles.H1}>{item.name}</Text>
 <Text style={styles.H2}>{item.location}</Text>
 </View>

项目正在正确解析 json 名称。但我有两个项目位于{flag:'', country:''}

我如何解析上面代码中的这两项。

如果您正在尝试渲染位置,那么您可以试试这个提供的位置是一个对象,其中带有国旗和国家/地区作为位置的属性

<View style={{ flexDirection: 'row' }}>
      <AntDesign name="flag" size={12} color="black" style={{ marginTop: 
     3, marginRight: 10 }} />
     <Text style={styles.H1}>{item.name}</Text>
     <Text style={styles.H2}>{item.location.country} </Text>
     <Text style={styles.H2}>{item.location.flag} </Text>
</View>