Created
May 25, 2016 01:39
-
-
Save davepoon/85cc80717ba28a9dac7e571777f68912 to your computer and use it in GitHub Desktop.
A quick way of binding to methods of React class
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
constructor() { | |
for (const methodName of [ | |
'yourMethod1', | |
'yourMethod2', | |
'yourMethod3', | |
]) { this[methodName] = this[methodName].bind(this); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment