I\'ve been trying to learn the basics of React. However, I\'ve come across a section in the tutorial that asks me to place an alert() inside of an onClick event
Because you need a function that gets called only in the instant that the button is clicked. If you pass alert('click') then the parser will find a function call and execute it instantly when it is going over that file.