Create a Controlled Input: Where is my mistake?

Hello,

Create a Controlled Input

I don’t understand why my code doesn’t work. For me it’s the same the Fcc solution:

class ControlledInput extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      input: ''
    };
    // Change code below this line
    this.handelChange = this.handelChange.bind(this);
    // Change code above this line
  }
  // Change code below this line
handelChange(event) {
  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}/>
        { /* Change code above this line */}
        <h4>Controlled Input:</h4>
        <p>{this.state.input}</p>
      </div>
    );
  }
};

Typo in the event handler:

handelChange
    ^^

:triumph::grin::+1:thanks a lot jenovs

Have you some tricks to find this kind of mistakes?

Most text editors and IDEs can help you identify typos. Otherwise you can just read line by line and use other debugging techniques.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.