storybook-eol/react-treebeard

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

MorganaUzhgorod opened this issue · 6 comments

I use TreeBeard as component. Can anybody help please?

...      
import { Treebeard } from 'react-treebeard';
...
      <Treebeard
          data={data}
          onToggle={this.onToggle}
        />

Warning in my console:

Снимок экрана 2019-06-18 в 18 19 39

Hi @MorganaUzhgorod! Do you have an id attribute in each child?

const data = {
id: 1,
name: 'something'
...
}

@maximilianoforlenza No, I do not have :( I receive this data (Files tree list) from backend

@MorganaUzhgorod That's the problem, because actually react-treebeard doesn't has a "default index"

@maximilianoforlenza, ok, Thanks 🖖
I wrote temporary solution. Function that add id to each element of JSON, and it's work without warning for this time.
Thanks ✋

@ MorganaUzhgorod

I use 3.2.4

Screen Shot 2019-10-11 at 11 16 47 AM

test folder in the children causes same problem. Both folders have id