sumnerbhandal / bwa-u3-jammming-prj

0 stars 0 forks source link

Test data error: Warning: Each child in an array or iterator should have a unique "key" prop. #3

Open melissamcewen opened 6 years ago

melissamcewen commented 6 years ago

I was getting this error in my console:

 index.js:2178 Warning: Each child in an array or iterator should have a unique "key" prop.

Check the render method of `TrackList`. See https://fb.me/react-warning-keys for more information.
    in Track (at TrackList.js:10)
    in TrackList (at SearchResults.js:10)
    in div (at SearchResults.js:8)
    in SearchResults (at App.js:77)
    in div (at App.js:76)
    in div (at App.js:74)
    in div (at App.js:72)
    in App (at index.js:7)

And I took a look at your TrackList.js and since it did have a Key prop I was like "why is this happening?" Oh but then I realized it's the test data doing this!

https://github.com/sumnerbhandal/bwa-u3-jammming-prj/blob/master/jammming/src/Components/App/App.js#L12-L25

the test data is fine for visualizing things and testing things but yeah it doesn't have a track id for a key so it gives this error. I'd remove it before deploying if you want to deploy because of that and also seeing test data can confuse users.

sumnerbhandal commented 6 years ago

Thanks Melissa, I left it in while I was toying with the styling, but you're right it can be confusing for users.