To add an event handler, we first define the function for that event and then pass it as a prop to the appropriate JSX tag.
For example if you want to show a message on clicking to a button, you can define that in a function starting with ‘handle’ or ‘on’ the camel case event name, here it is ‘handleClick’. Then we wil pass that function as a prop to the button tag.
Event handlers must be passed, not called! onClick={handleClick}, not onClick={handleClick()}.