Can't figure out why I get this warning:
"Warning: Each child in an array or iterator should have a unique "key" prop. Check the top-level render call using BootstrapTable."
My code:
import React from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
const data = [
{id: 1, name: 'Item name 1', price: 100},
{id: 3, name: 'Item name 3', price: 55},
{id: 2, name: 'Item name 2', price: 100}
];
const cols = Object.keys(data[0]);
export default () => {
return (
<BootstrapTable data={data}>
{cols.map(name => {
let key = name === 'id' ? true : false;
return (
<TableHeaderColumn dataField={name} isKey={key}>
{name}
</TableHeaderColumn>
);
})}
</BootstrapTable>
);
};`