Manage State Locally First

Manage State Locally First
0.0 0

#1

I honestly have no idea why the code won’t pass, any help would be appreciated!

class DisplayMessages extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      input: "",
      messages: []
    }
  }
  // add handleChange() and submitMessage() methods here
handleChange = (e) => {
  let input = e.target.value
  this.setState({input:input})
}

submitMessage = () => {
  this.setState({
    input: "",
    messages: [...this.state.messages, this.state.input]   
  })
}
  render() {
    return (
      <div>
        <h2>Type in a new Message:</h2>
        { /* render an input, button, and ul here */ }
          <input onChange={this.handleChange} value={this.state.input} />
          <button onClick={this.submitMessage}>Add message</button>
          <ul>
          {this.state.messages.map(message => <li>message</li>) }
          </ul>
        { /* change code above this line */ }
      </div>
    );
  }
};

#2

don’t use arrow functions that why it didn’t work