Handling Reacts' "Warning: Each child in an array or iterator should have a unique "key" prop" msg

65 views
Skip to first unread message

Oliver Mooney

unread,
Nov 26, 2015, 3:22:36 PM11/26/15
to Enfocus
Hi,

How do you attach a unique key prop to each element created by a snippet? I'm using the (map snippet data) idiom to create multiple children (rows in a table) using kioo, and the React warning of not creating a unique key appears. It's causing some problems when I delete then add data in the underlying model, and the generated HTML re-uses the React id, and so doesn't reflect the underlying data correctly.

I'm using the Reagent variant.

Thanks,
Oliver.

Creighton Kirkendall

unread,
Nov 26, 2015, 9:59:22 PM11/26/15
to Enfocus
Oliver, you should be able to set the attribute :key to an index value or something to avoid this.

Creighton

--

---
You received this message because you are subscribed to the Google Groups "Enfocus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enfocus+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oliver Mooney

unread,
Nov 27, 2015, 3:56:43 AM11/27/15
to Enfocus
Thanks Creighton! Did I miss that in the docs? I could submit a pull request to the intro guide that includes it?
Reply all
Reply to author
Forward
0 new messages