Skip to content

Instantly share code, notes, and snippets.

@glortho
Created October 15, 2015 14:44
Show Gist options
  • Save glortho/3d64d4158c8f85987ae2 to your computer and use it in GitHub Desktop.
Save glortho/3d64d4158c8f85987ae2 to your computer and use it in GitHub Desktop.
autobind
class MyClass extends React.Component {
@autobind
myMethod() {
console.log( `${this.props} works now` );
}
}
@autobind
class MyClass extends React.Component {
myMethod() {
console.log( `${this.props} works now` );
}
myOtherMethod() {
console.log( `${this.props} works here too` );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment