0

I’m building a React component that accepts a JSON data source and creates a sortable table.
Each of the dynamic data rows has a unique key assigned to it but I’m still getting an error of:

Each child in an array should have a unique “key” prop.
Check the render method of TableComponent.

My TableComponent render method returns:

{ rows }

The TableHeader component is a single row and also has a unique key assigned to it.
Each row in rows is built from a component with a unique key:

And the TableRowItem looks like this:
var TableRowItem = React.createClass({
render: function() {

var td = function() {
return this.props.columns.map(function(c) {
return

{this.props.data[c]}

;
}, this);
}.bind(this);

return (

{ td(this.props.item) }

)
}
});

What is causing the unique key prop error?

Kuldeep Baberwal Changed status to publish January 28, 2025