Looping through array items with JSX
function Component() {
const fruits = [
{ name: 'banana', id: 1 },
{ name: 'apple', id: 2 },
{ name: 'orange', id: 3 }
]
return (
<ul>
{ fruits.map(fruit => (
<li key={ fruit.id }>{ fruit.name }</li>
)) }
</ul>
)
}