Skip to content

Instantly share code, notes, and snippets.

@zzarcon
Created September 10, 2017 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzarcon/e852f423f0304fd7549add616474ab2a to your computer and use it in GitHub Desktop.
Save zzarcon/e852f423f0304fd7549add616474ab2a to your computer and use it in GitHub Desktop.
Bind call to class property
// FROM:
class Foo {
constructor() {
this.bar = this.bar.bind(this);
}
bar() {
return 1;
}
}
// TO:
class Foo {
bar = () => {
return 1;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment