Created
January 14, 2018 00:14
-
-
Save ameliabradley/44790bfba7eb2a96c4b47aa7762e0c41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoggingButton extends React.Component { | |
// This syntax ensures `this` is bound within handleClick. | |
// Warning: this is *experimental* syntax. | |
handleClick = () => { | |
console.log('this is:', this); | |
} | |
render() { | |
return ( | |
<button onClick={this.handleClick}> | |
Click me | |
</button> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment