Jamming- Cannot read property 'map' of undefined


I’m having a problem with this project.
When I write a map functin to this.props.tracks I get an error “Cannot read property ‘map’ of undefined”.
tracks is defined as a prop to TrackList in searchresults.js… why is it undefined ?

Thank you

Not sure if you are still stuck on this or not, but I had a similar issue. It’s probably not that you didn’t define tracks, but that whatever function is supposed to set the values for tracks isn’t doing its job properly. So the tracks array is probably empty, which is causing the map function to freak out. Try logging tracks to the console or use the react component debugger to see what its actual value is.

Hey, do you still need help with this project? We’d need to see your code and the full code error (which should reference the line the error occurs) to be able to help troubleshoot it with you.

Here’s some tips from the community guidelines regarding getting help:

The Do’s and Don’ts

Do format your code before posting.

  • Do make sure you post your question in the right category.
  • Do make sure you put the instructions, error and link to the exercise you are stuck on in your post.
  • Do make sure you put the exercise number in the post title.
  • Do ask for help if you need it!

✘ Don’t ask for help on an exercise without posting code.