React: Create a Controlled Input[Confused]

Tell us what’s happening:
I feel like i have followed the provided information from the excercise correctly, the output is being processed as i type, but it still doesn’t let me pass the excercise. Been struggling all day, please help

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() {
  this.setState({
    input: event.target.value
  });
}
// Change code above this line
render() {
  return (
    <div>
      { /* Change code below this line */}
      <input onChange={this.handleChange} value={this.state.input}/>
      { /* 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36.

Challenge: Create a Controlled Input

Link to the challenge:

Hi @Temzarone. You need to pass event as a parameter to the handleChange event handler so that you have:

handleChange(event) {
  this.setState({
    input: event.target.value
  });
}
1 Like

oh man, thank you so much!

1 Like