So i'm new to react native and i'm trying to display nested elements of a Json fetched data, but i can't figure out how to do it. After using react hooks in the fetch api:
export default function MedProfilScreen({ route }) {
//const {id,name,specialite,work}=route.params;
const [data, setData] = useState([]);
useEffect(() => {
fetch("http:......")
.then(response => response.json())
.then(res => {
setData(
res);
console.log(res);
})
.done();
},[]);
}
i got this reponse:
Array [
Object {
"code": "12459552",
"id": 7,
"name": "Dr xavier vilan",
"speciality": "Cardio",
},
Object {
"education": Array [
Object {
"date_debut": "2020-02-07",
"date_end": "2020-02-06",
"diploma": "asmaa",
"school": "asmaa",
"city": "vullez",
},
]}
]
so i want to display for example: name: Dr xavier.. diploma: asmaa
return(
<View> name: Dr xavier.. diploma: asmaa </View>
)
anyone have an idea how to do it please.thank you
