Getting Started with React Redux

Getting Started with React Redux
0

#1

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/


#2

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 />
  }
};

#3

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, try to stick with just giving hints and suggestions or related examples instead of just posting a full working solution.

Thank you.