For some reason when I try and enter JavaScript into the angle part of the HTML portion it does not work. I\'m using Thymeleaf.
Here\'s the HTML portion:
I was getting the error because Thyemleaf thought that I was typing HTML: I just added this:
/*<![CDATA[*/
...
/*]]>*/
Try this:
<button className="btn btn-info" onClick={() => this.displayInfo()}>Click for info about {firstName[i]}</button>
you should pass an arrow function in your onClick event