Guest User

Untitled

a guest
Dec 13th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class ButtonComponent extends React.Component {
  2. constructor(props) {
  3. super(props)
  4. this.state = {
  5. message: 'I do not need to be manually binded!',
  6. }
  7. }
  8.  
  9. // this is now defined using the arrow function syntax
  10. handleClick = () => {
  11. console.log(this.state.message)
  12. }
  13.  
  14. render() {
  15. return
  16. < button onClick={this.handleClick} />
  17. }
  18. }
Add Comment
Please, Sign In to add comment