Skip to content

Instantly share code, notes, and snippets.

@davepoon
Created May 25, 2016 01:39
Show Gist options
  • Save davepoon/85cc80717ba28a9dac7e571777f68912 to your computer and use it in GitHub Desktop.
Save davepoon/85cc80717ba28a9dac7e571777f68912 to your computer and use it in GitHub Desktop.
A quick way of binding to methods of React class
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