Map State to Props- can not read property 'pop' of undefined?

Tell us what’s happening:
Okay, know I have this:
But why I get an error “can not read property ‘pop’ of undefinded”???

Your code so far


const state = [];

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

Your browser information:

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

Link to the challenge:

I don’t understand the error but I can tell you that the program crashes because you are not doing what you are supposed to:

Blockquote Passing an array as state to mapStateToProps should return this array assigned to a key of messages .

So you have to modify this

messages: state

instead of

messages: messages

Hope this helps you