var B = React.createClass({
render: function() {
return (
<div>
<input type="button" onClick={this.props.saveFunction} />
</div>
);
}
});
var A = React.createClass({
render: function() {
return (
<div>
<B saveFunction={this.save} />
</div>
);
},
save: function(){
//Save code
}
});
Hello, I am working in facebook react js. I have created two components wherein A is parent component and B is child component. I have written Save function in A and passing its reference as "props" to component B. I am passing this Save function reference to "onClick" event of button rendered from B and I also want to save the values when user press the ENTER button. So, I am trying to pass the same reference to "onKeyDown" event of same button. But, its not working. Contstraint is: I can't shift save function from A to B. Please let me know how I can achieve this. Thanks in advance!