Let's look at what events are in the next video.
As seen in the last video, an event is an action to be taken as a result of user interactions. An event handler is a method to be called when an event occurs. A programmer can define a series of steps inside an event handler, which can be followed when the specified event occurs.
Let’s look at how to deal with event handling in React in the next video.
So, now you have seen how to write event handlers in React.
Notes:
An event name should follow camelCase.
It is a good practice to prefix event handlers with on, such as ‘onSubmitOrder’, or suffix them with handler, such as ‘submitOrderHandler’. This is done so as to make clear what these handlers do and what events they are attached to.
To learn more about all the supported events in React, follow this link.
Later on, you’ll learn how to add the delete functionality, which will be used to delete a subscriber from the Phone Directory application. This is why you do not need this onClick event handler right now. So, delete the onClick event that you have bind with the Delete button. Also, delete the clickHandler function defined for the onClick event on the Delete button.
Additional Resources: