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 React from "react";
import { render } from "react-dom";
import MyList from "./MyList";
const items = [
{ id: 0, name: "First" },
{ id: 1, name: "Second" },
{ id: 2, name: "Third" }
];
render(<MyList items={items} />, document.getElementById("root"));
Each item in the list has an id property, which is used to identify the item. You'll need to be able to access this ID when the item is clicked on in the UI so that the event handler can work with the item. Here's what the MyList component implementation looks like:
import React, { Component } from "react";
export default class...