React Component Event Handlers
Note: I published this article on codeburst/Medium on 2017/07/30. It has received 18.3k views and 235 claps as of 2019/01/05.
What should be put in the onClick={…}?
A simple example: Toggle button This example is from React Docs, see it on codepen here.
In the Toggle class, a handleClick method is defined as an instance method, which changes the local state. In the render method, this.handleClick is passed to the button as an event handler.