I have this here component. I want to pass down a call handler to each listElement I create. If I do it like below, with bind(this)
, it works properly. The prob
The error is coming from somewhere else in the code. You get the error when you do this.someFunction.bind(something)
and something isn't null
.
this.someFunction.bind({}, foo); // warning
this.someFunction.bind(this, foo); // warning, you're doing this
this.someFunction.bind(null, foo); // okay!
Do a search for .bind(this
in your code to find the offending line.
Here is updated docs example
React.createClass({
onClick: function(event) {/* do something with this */},
render: function() {
return <button onClick={this.onClick} />;
}
});
Update in ReactJS Docs