Created
July 9, 2017 14:01
-
-
Save adaschevici/b29890dcb085739220db09dc2a324a80 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 ExampleComponent extends React.Component { | |
constructor() { | |
super(); | |
this. _handleClick = this. _handleClick.bind(this); | |
} | |
render() { | |
return <div onClick={this._handleClick}>Hello, world.</div>; | |
} | |
_handleClick() { | |
console.log(this); // this is an ExampleComponent | |
} | |
const boundHandleClick = () => { | |
console.log(this); // this is an ExampleComponent | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment