adrianhajdin / aora

Build your first mobile application
https://jsmastery.pro
1.06k stars 191 forks source link

Warning: Each child in a list should have a unique "key" prop. #24

Open skardtechDeveloper opened 1 month ago

skardtechDeveloper commented 1 month ago

I got an error in home.jsx in flatlist.

Lagnajit09 commented 1 month ago
<FlatList
        data={posts}
        keyExtractor={(item) => item.$id}
        renderItem={({ item, index }) => <VideoCard key={index} video={item} />}

You should try to add a index as a key like this.

AwwdLabs commented 2 weeks ago

key={index} when you are mapping anything out. Which is the <VideoCard? by the looks of it, so the key={index} is required by its parent