Input element does not update the state

Tell us what’s happening:
Hi,
I can not pass the test. Error message is:" Typing in the input element should update the state and the value of the input, and the

element should render this state as you type."

What am I missing in bellow code?
Thaaanx!

Your code so far


class ControlledInput extends React.Component {
constructor(props) {
  super(props);
  this.state = {
    input: ''
  };
  // change code below this line
this.handleChange=this.handleChange.bind(this);
  // change code above this line
}
// change code below this line
handleChange(event) {
  this.setState({
    input: event.target.value
  });
}

handleChange(event) {
  this.setState({
submit:this.state.input
})
}

// change code above this line
render() {
  return (
    <div>
      { /* change code below this line */}
<input onChange = {this.handleChange.bind(this)}/>
      { /* change code above this line */}

      <h4>Controlled Input:</h4>
      <p>{this.state.input}</p>
    </div>
  );
}
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36.

Challenge: Create a Controlled Input

Link to the challenge:

I see two problems:

  1. You have two _ handleChange_ methods. You need to pick the right one.
  2. You input needs a value property.

When I make those changes, your code passes for me.

1 Like