Manage State Locally First help

Tell us what’s happening:
my last test is not passing in this? whats wrong in it?

Your code so far


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

  submitMessage() {
    let concatMessage = [...this.state.messages,this.state.input];
    this.setState({
      messages: concatMessage,
      input:''
    });
  }

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react-and-redux/manage-state-locally-first

what does this line do?

Nevermind. I just realised. I’ll try your code…

Edit: hmm. I just cut and pasted your code into my FCC chrome browser and it worked perfectly…
Which browser do you use?

concatMessage will add new meassage to the state value of messages
ok its working in chrome and it works in firefox too… thanks, I was using safari and I don’t know why it isn’t passing in it?

i guess different browsers don’t support the same apis that FCC code is using. So I suggest you stay with chrome for FCC use.

ok thanks now I will stick with chrome