I have 2 basic components here and I get an error when trying to map over my elements:
class EleMenu extends Component {
render(){
return (
<li className="eleMenu">{this.props.name}</li>
)
}
}
class MainMenu extends Component {
const rows = []
this.props.elements.forEach() //error here
(e) => {
rows.push(
<EleMenu
name={e.name}
>
<EleMenu/>
)
}
);
render(){
return (
<ul className="mainMenu">
{rows}
</ul>
)
}
}
It says unexpected token for the line: this.props.elements.forEach()