Declaring event handlers
The differentiating factor with event handling in React components is that it's declarative. Contrast this with something such as jQuery, where you have to write imperative code that selects the relevant DOM elements and attaches event handler functions to them.
The advantage of the declarative approach to event handlers in JSX markup is that they're part of the UI structure. Not having to track down code that assigns event handlers is mentally liberating.
In this section, you'll write a basic event handler so that you can get a feel for the declarative event-handling syntax found in React applications. Then, you'll learn how to use generic event handler functions.
Declaring handler functions
Let's take a look at a basic component that declares an event handler for the click event of an element:
import * as React from "react"; class MyButton extends React.Component { onClick() { ...