Created
March 23, 2017 21:55
-
-
Save maurobringolf/1f2b960efeb5ea367b93f3ecd282de45 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 myComponent extends React.Component { | |
constructor() { | |
super() | |
// Replace existing method with hardbound version of it | |
this.someMethod = someMethod.bind(this) | |
} | |
someMethod() { | |
// Do something that relies on 'this' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment