IgniteUI / igniteui-react

High-Performance Data Grid and High-Volume Data Charts
Other
6 stars 1 forks source link

Each child in a list should have a unique "key" prop error is logged in the console #58

Closed wnvko closed 7 months ago

wnvko commented 7 months ago

Description

Each child in a list should have a unique "key" prop error is logged in the console when add igniteui component to the view.

Steps to reproduce

I have this component:

import { IgrButton, IgrButtonModule } from 'igniteui-react';
IgrButtonModule.register();
export default function IgView() {
  return (
    <div>
      <IgrButton><span>Button</span></IgrButton>
    </div>
  );
}

Result

Each child in a list should have a unique "key" prop error is logged in the console.

Expected result

Adding igniteui component should not log any errors in the console.

MayaKirova commented 7 months ago

@wnvko @ChronosSF Unfortunately this is by design for all react components that have children, more info and additional discussion around this can be found here

You can resolve it by adding key to any child you add inside the components, for example:

 <IgrButton><span key="myKey">Button</span></IgrButton>
MayaKirova commented 7 months ago

Closing since key is required by design in the current wrappers.