Jammming project - TrackList props are showing in dev tools but trying to use map() on them gives a TypeError showing as undefined

You’ve answered the question for both of you.
Look at your App.js. In your render you have a Playlist element, correct?

You also have this on it playlistName={this.state.playlistName} yes?

Where is this.state.playlisyName defined? If it is like @gideongoddard’s code then it isn’t. And in Playlist you have this line <TrackList tracks={this.props.playlistTracks} />, right? So now you can see why it becomes undefined.

So it have a value when TrackList is used in SearchResults but then it renders the PlayList and that is when that instance of the TrackList component gets a this.props.tracks that is undefined. Remember, you have 2 individual TrackList elements with their own props being passed in.

If multiple people are getting here from following the same material, either the material isn’t clear on what you should be doing or it is wrong.

3 Likes