React-bootstrap-table2: Warning: Each child in an array or iterator should have a unique "key" prop.

Created on 18 Feb 2018  路  17Comments  路  Source: react-bootstrap-table/react-bootstrap-table2

When I send data as props I have error for iterator key.
image

Warning: Each child in an array or iterator should have a unique "key" prop.

Check the render method of Body. See https://fb.me/react-warning-keys for more information.
in Row (created by Body)
in Body (created by BootstrapTable)
in table (created by BootstrapTable)
in div (created by BootstrapTable)
in BootstrapTable (created by PaginationWrapper)
in PaginationWrapper (created by SortWrapper)
in SortWrapper (created by BootstrapTableContainer)
in BootstrapTableContainer (at RemotePagination.js:66)
in RemotePagination (created by Connect(RemotePagination))
in Connect(RemotePagination) (at Merchants.js:178)
in div (at Merchants.js:166)
in section (created by styled.section)
in styled.section (at Merchants.js:165)
in div (at Merchants.js:164)
in div (at Merchants.js:163)
in Merchants (created by Connect(Merchants))
in Connect(Merchants) (created by Route)
in Route (at DashboardLayout.js:39)
in Switch (at DashboardLayout.js:37)
in main (at DashboardLayout.js:35)
in div (at DashboardLayout.js:33)
in div (at DashboardLayout.js:32)
in section (created by styled.section)
in styled.section (at DashboardLayout.js:30)
in AuthorizedLayout (at requireAuth.js:27)
in Authenticate (created by Connect(Authenticate))
in Connect(Authenticate) (created by Route)
in Route (at routes.js:34)
in Switch (at routes.js:20)
in div (at routes.js:17)
in Router (created by BrowserRouter)
in BrowserRouter (at routes.js:16)
in Routes (created by Connect(Routes))
in Connect(Routes) (at index.js:42)
in Provider (at index.js:41)

Most helpful comment

it seems like use keyField as the unique key prop. if the value of the "keyFiled" is not unique in your code, you will see that error message.....

All 17 comments

@siamak Please post the code that you've tried. Thanks.

also post your data @siamak

It's a bug in my code. Thanks.

same problem...here is data&code, confusing...

image
image
image

@AllenFang could you have a look at this? Many thanks

The row object in the version 2 of bootstrapTable does not affect a key property in its rendering. This is why this error happens. There is probably a .map in the body rendering and it is missing it.

Is there a fix for this? Though not fatal, the warning is annoying.

I don't know!

are you sure that "good_id" exists in your "kinds_list" ?

It seems the warning is gone, anybody still with it? I guess it got fixed... react-bootstrap-table-next 1.2.0

It seems the warning is gone, anybody still with it?

I have version 1.3.1 and it's still happening to me, but only when my BootstrapTable is inside a ToolkitProvider :sweat:

I have the same problem...

I am facing same issues in 1.4.2

it seems like use keyField as the unique key prop. if the value of the "keyFiled" is not unique in your code, you will see that error message.....

it seems like use keyField as the unique key prop. if the value of the "keyFiled" is not unique in your code, you will see that error message.....

My keyField value is unique and I'm facing the same error... using version 3.3.3, there's no solution for that yet?

Make sure keyField is one of your columns' dataField and it is unique. Otherwise, you get the warning message.

Would be nice to have unique ids generated if keyField is not provided in case the table has no unique data, @AllenFang ?

Also make sure that the function is not anonymous, that is do not save the function to a variable. Put the function outside your render method. then hook it to the formatter using "this.yourFunctionName".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rsgoss picture rsgoss  路  4Comments

eylonronen picture eylonronen  路  3Comments

ethannkschneider picture ethannkschneider  路  3Comments

Randore picture Randore  路  3Comments

primakashi picture primakashi  路  3Comments