I’m trying to map over an array objects that contain other objects. See below:
I’m specifically trying to access the name
and url
properties inside the “buy_links” array.
Here’s my code so far. bestseller
returns data that I’ve mapped over elsewhere in my code - the trouble is just accessing that buy_links
array. Currently my code doesn’t break anything, but also doesn’t return any data.
<ul>
{bestseller.buy_links.map(({ table }) =>
Object.entries(table).map(({ name, url }) => (
<li key={url} style={{ color: "white", background: "red" }}>
<a style={{ color: "white", background: "red" }} href={url}>
{name}
</a>
</li>
))
)}
</ul>