in the previous three articles, we described the composition and life cycle of react components, and the mechanism of setState. This time let's talk about the handling of React events. 1. Native event system We usually monitor the real DOM. For example, 🌰, we want to listen for the click event of the button, so we can bind the event and the corresponding callback function to the button DOM. Unfortunately, if the page is complex and the frequency of event processing is high, it is a test for the performance of the web page. 2.React event system react's event handling, no matter how dazzling it is, will eventually return to the original event system, but its encapsulation is elegant. Let's go straight to the conclusion: React implements the SyntheticEvent layer to handle events What does mean? In detail, React does not correspond events to Dom one by one like native events, but binds all events to the document of the web page, processes and distributes them through a unified event listener, finds the corresponding callback function and executes it. According to the official documentation, the event handler will pass an instance of SyntheticEvent, so let's take a look at SyntheticEvent. 3.SyntheticEvent 1. Event registration as mentioned above, since React handles events uniformly, you must first need to register the event trigger function written by the programmer. So where is this process carried out? Because we are "binding" events to "component DOM", such as a click event: <Component onClick={this.handleClick}/> undefined React has already started event handling through the _ updateDOMProperties method…