Create a Controlled Form - react

Tell us what’s happening:
Hello friends, I would like to know why it would not work when I set the setState{submit:) of handleSubmit to event.target.value. It will be the same as the handleChange method, but why does handleChange updates the local state input, while it doesn’t update when I try to do the same thing on the handleSubmit method?

After a long struggle, I figured out that setting setState:submit be to the local state input would do the work and passed the challenge. But I still don’t understand why event.target.value won’t do the same work on submit like the handleChange. Thank you.

Your code so far


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
      this.setState({
      input: "",
      submit: event.target.value
    });
      event.preventDefault();
    // 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}></input>
          { /* 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>
    );
  }
};

Your browser information:

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

Link to the challenge: