reactjs - Get an inputs component props onBlur -
is possible props of input onblur
event?
with event.target.value
value of input.
is possible props
of component similar way?
sure can, here fiddle:
var hello = react.createclass({ onblur: function(e) { console.log(this.props) }, render: function() { return <div> <input onblur={this.onblur} /> </div>; } });
or if receive function parent property, should bind components context.
var hello = react.createclass({ render: function() { return <div> <input onblur={this.props.onblur.bind(this)} /> </div>; } }); function onblur(e) { console.log(this.props); console.log(e); } reactdom.render( <hello onblur={onblur} name="world" />, document.getelementbyid('container') );
Comments
Post a Comment