Sloved] Cant pass Create a Controlled Form

Tell us what’s happening:

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 = ({
      submit: this.state.input
    });
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} />
          { /* 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/68.0.3440.75 Safari/537.36.

Link to the challenge:

i dont know what i can’t i pass it.
anyone who knows why?

===============================
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 (



{ /* change code below this line / }

{ /
change code above this line / }
Submit!

{ /
change code below this line */ }

{this.state.submit}


{ /* change code above this line */ }

);
}
};

it was just freecodecamp editor error.
i suffered this error qutie few times…
if anyone who seen this post,
i hope the operator of this pages included as one of them :frowning:

Nevermind, I got it fixed.

This issue resides in this area.

handleSubmit(event) {
    this.setState = ({
      submit: this.state.input
    });

It should be:

handleSubmit(event) {
    this.setState({
      submit: this.state.input
    });