My code is working properly but it gives me a warning
Warning: bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call.
I also use onClick={this.myFun.bind(null,"myvalue")} as describe in the Why does React warn me against binding a component method to the object?
Still it give me warning.
My Code :
var MyClass = React.createClass({
myFun : function (value){
console.log(value);
},
render: function () {
var that = this;
var card = this.props.data.map(function (val,key) {
return (
<p onClick={that.myFun.bind(null,val)}> Click Me</p>
);
});
return (
<div>
{card}
</div>
);
}
});
` instead.
– Felix Kling Jul 21 '17 at 05:56