#How can I bypass unique key props
17 messages · Page 1 of 1 (latest)
if you choose to ignore this error there will be negative implications since react relies on key prop for its rendering logic
by default react will use the index for the key prop, even if you don't provide one
but if the order of your list ever changes you may not see the expected results when rerendering if you rely on index as a key
I see you already have an item.id in your code, instead of ignoring the error it's probably a lot safer to just resolve it
good explanation, But how do I give every child a key? because doing this by hand wont work the error still presist. How do I use the key in this case?
Your code above is doing it correctly
If it says there’s a duplicate key then there is a duplicate key
The keys usually come from database generated ids
I still have next-dev.js?3515:20 Warning: Each child in a list should have a unique "key" prop.
its logging twice
oh i see now its the backend thats also logging
well ID should work but it dosnt
{item.title} also should work right ? I mean every item has its own title its unique