react loop object code example
Example 1: react js iterate object
<div className="iterate-object">
{
<ul>
{Object.keys(OBJECTHERE).map(function(keyName, keyIndex) {
return (
<li key={keyName}>
{keyName}
{console.log(OBJECTHERE[keyName])}
</li>
)
})}
</ul>
}
</div>
Example 2: react render for loop
// for loop workaround in react render
[...Array(n)].map((_, index) => <span key={index}>element {index}</span>)