Using the current index as the key for a component should only be a last resort. Because React uses the keys of components to figure out what changed and what to update in the app, having new components added to an array whose current components have the index as their key could cause unnecessary updates and may throw off the UI. It is often best to use some generated unique id as the key, which in our case, can be the track id!
Using the current index as the key for a component should only be a last resort. Because React uses the keys of components to figure out what changed and what to update in the app, having new components added to an array whose current components have the index as their key could cause unnecessary updates and may throw off the UI. It is often best to use some generated unique id as the key, which in our case, can be the track id!
can be turned into
in the
TrackList.js
file