简体   繁体   中英

Semantic UI React -- Can't Set Key Property on Table Row

I'm displaying a list of results from an API in a Table using Semantic UI React.

The table displays correctly but getting the following error:

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

I'm mapping an array and displaying like so:

 <Table.Row key={card.id}>

When i look at the html results, there is no key in the TR.

if i change the table row to id={card.id} or any other variable, the results show, but not key

Is there something different i need to do with Semantic UI? I didn't see anything in the documentation.

I figured this out. Posting for anyone that might have a similar issue.

I have a React Fragment right before the Table Row and figured out that it also needs a key. Thus, this was solved by doing the following:

 <React.Fragment key={card.id}>
              <Table.Row key={card.id}>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM