I'm trying to return a list of 'cards', each containing three components.
The parent, ItemCard, returns this:
<>
<article>
<ItemName data={items} />
<ItemMap data={items} />
<FavouriteButton data={items} />
</article>
</>
)
The child components each have a .map to render each item from the array:
const ItemName = (props) => {
return (
<>
{props.data.map((item) =>
<p key={item.title}>{item.title}</p>
)}
</>
)
}
I would like to surround the three components returned from ItemCard so that each instance is its own article. Currently I get one big article containing a list of ItemNames, then ItemMaps, then Buttons. I'd like 25 individual articles, each with ItemName, ItemMap and Button.
My only idea was to use a forEach to do this, but I can't get it working.
Any tips much appreciated!