Where am I going wrong with my onChange function? I want to be able to type in my textbox, but I keep getting the following console error when I recompile:
**Uncaught TypeError: Cannot read property 'value' of undefined**
See code below:
export default React.createClass({
handleChange: function() {
this.props.onUserInput(
this.refs.name.value
)
},
render() {
return (
<div>
<div>{this.props.children}</div>
<Well style={style.well}>
<div style={style.userContent}>
<input style={style.userDetails}
id ="userName"
type="text"
onChange={this.handleChange()}
value ={name} />
<Button bsStyle="primary">Update</Button>
</div>
</Well>
</div>
);
}
});
Aucun commentaire:
Enregistrer un commentaire