react-native-collapsible
react-native-collapsible copied to clipboard
Warning: Each child in a list should have a unique "key" prop
I am receiving this warning when my app is rendered. All of the accordion function works fine.
How do i add key to each child inside accordion?
If you are trying to render dinamically the children inside the accordion, each one should have its own key, if the child does not have a unique id to set as key to the parent, you can combine the accordion section index with the child index, you must pass to the child parent view
<Child key={childObj.id.toString()} />
or
<Child key={${sectionIndex.toString()}_${childIndex.toString()}} />
same here!