1// Render a block of three buttons
2[1, 2, 3].map(buttonId => (
3 // Pass a parameter in 'value' attribute
4 <button
5 key={buttonId}
6 value={buttonId}
7 onClick={this.handleButtonClicked}
8 >
9 button {buttonId}
10 </button>
11));
12...
13handleButtonClicked = ev => {
14 this.setState({
15 // Retrieve a passed parameter 'value' attribute
16 message: `Button ${ev.currentTarget.value} clicked`
17 });
18};
19