Missing something in Create a Controller

That is my code.

class MyForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      input: '',
      submit: ''
    };
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }
  handleChange(event) {
    this.setState({
      input: event.target.value
    });
  }
  handleSubmit(event) {
    // change code below this line
      event.preventDefault()
this.setState({
  submit:this.state.input
})
    // change code above this line
  }
  render() {
    return (
      <div>
        <form onSubmit={this.handleSubmit}>
          { /* change code below this line */ }
          <input value={this.state.input} onChange={this.handleChange} />
          { /* change code above this line */ }
          <button type='submit'>Submit!</button>
        </form>
        { /* change code below this line */ }
          <h1>{this.state.submit}</h1>
        { /* change code above this line */ }
      </div>
    );
  }
};

What is wrong with it?

When I click submit, everything is working but test doesn’t allow me to go to the new topic.

Try refreshing the page and rerunning the tests. The code works. What browser are you using?

I am using Chrome. This is errors in screenshot

Try clearing your cache or using a different browser (Firefox?) to rerun the tests.

1 Like

It works! Thank you!