Getting Started with React Redux

Tell us what’s happening:

Your code so far


class DisplayMessages extends React.Component {
  // change code below this line
constructor()
super(props){
  input:""
  messages: []
}
  // change code above this line
  render() {
    return <div />
  }
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) 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/getting-started-with-react-redux/

I think you’re a bit confused with the syntax. You need to pass props to the constructor. Then within the constructor pass props to super and set this.state. A passing solution would be:

class DisplayMessages extends React.Component {
  // change code below this line
  constructor(props){
    super(props);
    this.state = {
      input:"",
      messages:[]
    }
  }
  // change code above this line
  render() {
    return <div />
  }
};
1 Like