I have an object that has an array of objects inside it, and this array has another array of objects inside it. I'm using map to render html and when I use map inside another map shows an error, so using console.log, sometimes it shows the value and other times it shows undefined. Something it's happening in the render.
{
"id": "foo"
"adSets": [
{
"id": "adset1",
"name": "adset1",
"ads": [
{
"id": "ad1",
"name": "ad1",
}
]
},
{
"id": "adset2",
"name": "adset1",
"ads": [
{
"id": "ad2",
"name": "ad2",
},
{
"id": "ad3",
"name": "ad3",
}
]
}
]
}
{campaignData.adSets.map((adSet) => {
console.log(adSet.ad)
return (
<li key={adSet.id}>
<span className="">{adSet.name}</span>
<ul>
{adSet.ads.map((ad) => {
return (
<li key={ad.id}>
<span className="">{ad.name}</span>
</li>
);
})}
</ul>
</li>
);
})}