I am rendering the unordered list elements based on array of objects. Here is my list array return inside this.state.
this.state = {
cards: [{name: "card1", id: 1}, {name: "card2", id: 2}, {name: "card3", id: 3}]
};
Using render() i will be listing the list elements.
render() {
return ( <ul>
this.state.cards.map((card) => {
return <li>{card.name}</li>
});
</ul>
)
}
Uncaught Error: Module build failed: SyntaxError: Cards.js: Unexpected token (26:41). So the error is exactly at this point.
->sign for an arrow function while the code snippet is using correct=>sign