(Resolved, misspelling) Map State to Props, arrow function vs regular function

Tell us what’s happening:
why when I use arrow function it will works, but when I use regular function, it doesn’t work?

Your code so far

// it works
const state = [];

// change code below this line
const mapStateToProps = state => {
  return { messages: state }
}
// it doesn't work
const state = [];

// change code below this line
function mapStateToProps(state) {
   return {message: state}
 }

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36.

Link to the challenge:

return { messages: state }
return {message: state}

Are you sure both are valid?

Thank you very much.

My bad, misspelling!!!

1 Like