I am interested to know why this code - rendering HTML elements with data from array using Array.map() - works fine and elements appear on screen:
<div className="container">
{data.map((d) => (
<div className="item">
<img
src={d.img}
alt=""/>
<h3>{d.title}</h3>
</div>
))}
</div>
but this code - rendering HTML elements with data from an object using forEach() - doesn't work and nothing appears on screen although no error is thrown and console.log()'s within <div className="betCard"></div>
work fine:
<div className="container">
{Object.keys(data).forEach((bet) => (
<div className="betcard">
<p>{data[bet]["name"]}</p>
<p>{data[bet]["oddsDecimal"]}</p>
<p>{data[bet]["genericName"]}</p>
</div>
))}
</div>