3 回答
TA贡献1818条经验 获得超7个赞
我不知道这就是你要找的东西,但我会试一试:
代码:
const renderText = () => {
// as soon as we received the data, we will display it
if (data.length > 0){
return (
<Text> name: {data[0].name} diploma: {data[1].education[0].diploma}</Text>
)
}
}
return (
<View>
{renderText()}
</View>
);
输出:
TA贡献1831条经验 获得超4个赞
由于您已经将响应保存在data数据中,因此应该是这样的,
data = [
{
code: "12459552",
id: 7,
name: "Dr xavier vilan",
speciality: "Cardio"
},
{
education: [
{
date_debut: "2020-02-07",
date_end: "2020-02-06",
diploma: "asmaa",
school: "asmaa",
city: "vullez"
}
]
}
]
现在您可以访问name&diploma如下,
name: data[0].name
diploma: data[1].education[0].diploma
添加回答
举报