【发布时间】:2021-06-16 13:42:27
【问题描述】:
我遇到以下错误:
Warning: Each child in a list should have a unique "key" prop.
Check the render method of `App`.
See https://reactjs.org/link/warning-keys for more information.
WithStyles@http://localhost:3000/static/js/vendors~main.chunk.js:39295:25
App@http://localhost:3000/static/js/main.chunk.js:197:91
这是我的代码:
function Table({ countries }) {
return (
<div className="table">
{countries.map(({ country, cases }) => {
<tr>
<td>{country}</td>
<td>
<strong>{cases}</strong>
</td>
</tr>
})}
</div>
)
}
【问题讨论】:
-
一个好的标题应该传达问题而不是你有问题需要帮助,因为这是假设的,因为你在 Stack Overflow 上提问。