Ref to ReactJS tutorial. https://reactjs.org/tutorial/tutorial.html#setup-option-2-local-development-environment
<button className="square" onClick={()=>alert('u clicked' + this)}>
The code above is working fine. However, when i had made the changes.
button className="square" onClick={function() {alert('u clicked: ' + this)}}>
the code above is not working.
Based on the explanation from (https://yehudakatz.com/2011/08/11/understanding-javascript-function-invocation-and-this/), THIS will be auto binded. How can we manual bind for second code?
Next modification i had made
<button className="square" onClick={alert('u clicked' + this)}>
THIS is shown, but it was called, during load. Why?
Thanks in advance.