1import React, { Component } from 'react';
2
3class App extends Component {
4 constructor(props) {
5 super(props);
6 this.handleClick = this.handleClick.bind(this);
7 }
8
9 handleClick = (event) => {
10 alert(event.target.innerText); // Click Me
11 alert(event.target.tagName); // BUTTON
12 }
13
14 render() {
15 return (
16 <div>
17 <div className="text-center">
18 <button className="btn btn-secondary" onClick={this.handleClick}>
19 Click Me
20 </button>
21 </div>
22 </div>
23 );
24 }
25}
26
27export default App;