react onclick=(() => alert) code example
Example 1: react why onclick property function trigger without click
change:
<button type="button" onClick={this.myFunction(argument)}> myButton </button>
to this:
<button type="button" onClick={this.myFunction.bind(this, argument)}> myButton </button>
Example 2: react button onclick
<button onClick={sayHello}>Click</button>