Getting key prop warning in React, even though key is set
Have you tried adding a key
to the <th>
tag?
<tr>
{_.keys(this.props.list[0]).map(function (key) {
if (key !== 'attributes') {
return <th key={key}>{key}</th>;
}
})}
</tr>
I ended up solving it when I realized because I had a <React.Fragment>
which also needs a unique key.