-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Learn React with TypeScript - Third Edition
By :
Events are another key part of allowing a component to be interactive. In this section, we will understand what React events are and how to use events on DOM elements. We will also learn how to create our own React events.
We will continue to expand the Alert component’s functionality as we learn about events. We will start by finishing the close button implementation before creating an event for when the alert has been closed.
Browser events happen as the user interacts with DOM elements. For example, clicking a button raises a click event from that button.
Logic can be executed when an event is raised. For example, an alert can be closed when its close button is clicked. A function called an event handler (sometimes referred to as an event listener) can be registered on an element for an event that contains the logic to execute when that particular event happens.
Note
See the following link for more information on browser...