Okay so this is has been driving me mad for the past few hours. Pretty much i want to have a function that generates html based off of objects in an array that are passed to it as an argument. My Code looks something like this:
handleEvents = (array) => {
if(array.length > 0){
array.forEach(function(each){
return(<h1>hello {each.name}</h1>)
})
}
And in my render component i have this:
<div className="caption left-align">
<h3>Upcoming events</h3>
{this.handleEvents([{name: "Dave"}, {name: "Mary"}, {name: "Chris"}])}
</div>
But when i run this code nothing is being output to the screen. What should i do?