How do I access the following keys within this array of objects using the 'map' method? I want to access:
- 'id' inside 'moreInfo'
- 'fore' inside 'distances'
I get undefined for the following fields when I use
a.map((d) => console.log(d.moreInfo.id));
. I want to use the 'map' method itself so that I can render this content in my React application.
let a = [
{
"Id": "huih23432",
"name": "Kevin",
"dob": "26/06/1995",
"nid": "34535353543",
"images": {
"id": "https://picsum.photos/200",
"nid": "https://picsum.photos/200"
}
},
{
"moreInfo": [
{
"id": "243423423423",
"dob": "16/07/1990",
"name": "JD",
"images": {
"id": "https://picsum.photos/200",
"nid": "https://picsum.photos/200"
},
"distances": {
"fore": "0.91",
"towards": "0.5"
}
}
]
}
];
moreInfo, the second one does have it.