Skip to content

Instantly share code, notes, and snippets.

@evanscottgray
Created October 13, 2015 06:35
Show Gist options
  • Save evanscottgray/2ad7d39c8865877a08f8 to your computer and use it in GitHub Desktop.
Save evanscottgray/2ad7d39c8865877a08f8 to your computer and use it in GitHub Desktop.
class BaseComponent extends React.Component {
_bind(...methods) {
methods.forEach( (method) => this[method] = this[method].bind(this) );
}
}
class ExampleComponent extends BaseComponent {
constructor() {
super();
this._bind('_handleClick', '_handleFoo');
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment