src/components/App/App.js
// Checks whether track already exists in playlist. If it doesn't, it appends it.
Checks whether track already exists in playlist. If it doesn't, it appends it.
Checks whether track already exists in playlist . If it doesn ' t it appends it .
addTrack(track) {
        const playlistTracks = this.state.playlistTracks;
        if (playlistTracks.find((savedTrack) => savedTrack.id === track.id)) {
            return;
        } else {
            playlistTracks.push(track);
            this.setState({playlistTracks: playlistTracks});
        }
    }
addTrack ( track ) { const playlistTracks = this . state . playlistTracks ; if ( playlistTracks . find ( ( savedTrack ) => savedTrack . id === track . id ) ) { return ; } else { playlistTracks . push ( track ) ; this . setState ( { playlistTracks : playlistTracks } ) ; } }
Checks whether track already exists in playlist.
Checks whether track already exists in playlist .