Why on the lower example in createGrid i have to use array.map method when forEach is almost the same with
import React from 'react';
import Square from './Square.js'
const Board = ({squaresList}) => {
const createGrid = squaresList.map((item, i) => { // squareList.forEach not working here - not returning <Square/> components.
return(
<Square key={i}id={item.id}/>
)
})
return(
<div className='game-board-container'>
<div className='squares-container'>
{createGrid}
</div>
</div>
)
}
export default Board;