Map State to Props

Tell us what’s happening:

What’s wrong with this code?

Your code so far


const state = [];

// change code below this line
const mapStateToProps = (state) => {
  return {
    messages: [...state]
  }
}

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.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/front-end-libraries/react-and-redux/map-state-to-props

1 Like

You’re trying to spread an object into an array. You shouldn’t need to do anything at all to state but assign it.

1 Like