Using event handler context and parameters
In this section, you'll learn about React components that bind their event handler contexts and how you can pass data into event handlers. Having the right context is important for React event handler functions because they usually need access to component properties or state. Being able to parameterize event handlers is also important because they don't pull data out of DOM elements.
Getting component data
In this section, you'll learn about scenarios where the handler needs access to component properties, along with argument values. You'll render a custom list component that has a click event handler for each item in the list. The component is passed an array of values, as follows:
import * as React from "react"; import * as ReactDOM from "react-dom"; import MyList from "./MyList"; const items = [ { id: 0, name: "First" }, { id: 1, name: "...