I feel as though there is a bug that causes my code to fail. I keep getting " // running tests Typing in the input element should update the state and the value of the input, and the
p
element should render this state as you type. // tests completed
I would appreciate your feedback.
- Thank you
constructor(props) {
super(props);
this.state = {
input: ''
};
// change code below this line
// change code above this line
}
// change code below this line
handleChange(){
this.setState({
input: event.target.value
})
}
// change code above this line
render() {
return (
<div>
{ /* change code below this line */}
<input value = {this.state.input} onChange = {this.handleChange.bind(this)}
/>
{ /* change code above this line */}
<h4>Controlled Input:</h4>
<p>{this.state.input}</p>
</div>
);
}
};