I've got an onClick
props in a React component that contains the following:
onClick={_.bind(this.callMe, this, argToPass)}
Keep in mind, this is in a React component that uses React.createClass, so the component functions should be bound to it's context.
Unfortunately, when I attempt to bind this by doing the following:
onClick={this.callMe(argToPass)}
It breaks one of my tests.
I don't want to bind it as it's passed as props like this:
onClick={this.callMe(argToPass).bind(this)}
b/c of performance issues.
What is the vanilla javascript equivalent of:
_.bind(this.callMe, this, argToPass)
That will allow the function to bind correctly.
Thanks!