In App in removeTrack you have:
let newTracksState = this.state.playlistTracks;
Anything you do to newTrackState will mutate the component’s state and is very bad in React. Try something like this:
let newTracksState = this.state.playlistTracks.slice();
Using slice without any arguments will return a new copy of the entire array. This will let you use the variable safely.
In App in removeTrack you have:
Anything you do to
newTrackStatewill mutate the component’s state and is very bad in React. Try something like this:Using
slicewithout any arguments will return a new copy of the entire array. This will let you use the variable safely.