What is wrong with my code?
class Board extends React.Component{
constructor(props) {
super(props);
this.state = {
notes: ["note 1", "note 2", "note 3", "note 4", "note 5"]
}
}
render() {
let { notes } = this.state;
let displayNotes = notes.map((note) => {
return (
<Note noteText={note} />
);
});
return(
<div className="board">
{displayNotes}
</div>
);
}
}
I have the Note component which displays a div with the corresponding text.
When I remove the displayNotes from the Board component, it works.
If I console.log displayNotes before the return, it also works well…