table icon indicating copy to clipboard operation
table copied to clipboard

Console warning in "Simple->Sub-components" example: Missing unique "key" prop...

Open chrisnorwood opened this issue 6 years ago • 1 comments

Issue:

The following example gets a warning from React, as it introduces a second child (the expanded row) in each iteration of the row mapping: https://github.com/tannerlinsley/react-table/tree/master/examples/sub-components

The typical console warning can be seen showing in the CodeSandbox link included with the example, here

Notes:

I know that the getRowProps() function returns the key, but I'm not sure the best way to tackle updating this example, given the way it's currently written.

chrisnorwood avatar Dec 14 '19 00:12 chrisnorwood

The fragment there needs to become an actual React.Fragment component. Then it needs the key prop that would normally be given to the row via getRowProps() or just row.id too would work fine.

Tanner Linsley On Dec 13, 2019, 5:37 PM -0700, Chris Norwood [email protected], wrote:

Issue: The following example gets a warning from React, as it introduces a second child (the expanded row) in each iteration of the row mapping. The typical console warning can be seen showing in the CodeSandbox link, here Notes: I know that the getRowProps() function returns the key, but I'm not sure the best way to tackle updating this example, given the way it's currently written. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

tannerlinsley avatar Dec 14 '19 00:12 tannerlinsley