Create a Controlled Input. Where is mistake?

Tell us what’s happening:
Everything is working, but something don’t let me pass the test

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)
  }
handleChange(event) {
  this.setState({
    input: event.target.value
  });
    // change code above this line
  }
  // change code below this line

  // change code above this line
  render() {
    return (
      <div>
        { /* change code below this line */}
        <input value={this.state.value} onChange={this.handleChange} />
        { /* 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 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react/create-a-controlled-input

Your mistake is above, The state does not contain a property called value. It seems like it is working, but in truth you do not have a controlled input.

1 Like