how to return data as prop in react code example
Example: how to get the value in a tag in react
import React, { Component } from 'react';
class App extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick = (event) => {
alert(event.target.innerText);
alert(event.target.tagName);
}
render() {
return (
<div>
<div className="text-center">
<button className="btn btn-secondary" onClick={this.handleClick}>
Click Me
</button>
</div>
</div>
);
}
}
export default App;