Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ButtonComponent extends React.Component {
- constructor(props) {
- super(props)
- this.state = {
- message: 'I do not need to be manually binded!',
- }
- }
- // this is now defined using the arrow function syntax
- handleClick = () => {
- console.log(this.state.message)
- }
- render() {
- return
- < button onClick={this.handleClick} />
- }
- }
Add Comment
Please, Sign In to add comment