Jammming project - Cannot read property 'map' of undefined

Hey,

I’m doing the Jammming project which is part of the Full-Stack path and I’m stuck at step 41 of 99.

My app is erroring in the TrackList.js file on line 8, with “TypeError: Cannot read property ‘map’ of undefined”. Is this referring to this.props.track? If so, track is defined in App.js? I’ve followed the steps closely and also referred to the video to get help.

(src > Components > App > App.js and also TrackList > TrackList.js (which is the file erroring)).

Could anyone help, please? Appreciate any advice in advance!

Ben.

Well, unless my eyes deceive me, I think you’re looking for the proverbial needle in a haystack.

It looks like the map was passed as playlistTrack from App to Playlist but is then referenced as playlistTracks from Playlist to TrackList. I think it’s undefined because there is no playlistTracks prop, just playlistTrack.

When TrackList tries to access the map on an undefined prop, it throws the error.

2 Likes

That seems to have done it! I changed the instance of the Playlist component being passed from App - playlistTrack to playlistTracks and it resolved the problem and my app now renders. Thank you so much, saved me many more hours of head scratching.

1 Like

I was getting same error until i saw this thread, I’d already scratched my heads for past two hours and found out that i had used playListTracks prop instead of ‘playlistTracks’. Silly of me! Ahh :frowning:
Thanks BTW!!!