如何解决反应唯一键要求
我正在运行 GrandStack.IO Grandstack repo
中的 starterapp一切都出现并呈现,但我收到警告:
Warning: Each child in a list should have a unique "key" prop.
Check the render method of `RecentReviews`.
in WithStyles(ForwardRef(TableRow)) (at RecentReviews.js:48)
in RecentReviews (at Dashboard.js:48)
我已经阅读了所有关于此的内容,这实质上意味着循环应该具有唯一 ID 的组件。说得通。但是,第 48 行的表格行确实有一个键
<TableBody>
{data.Review.map((row) => ( <--this is line 48
<TableRow key={row.id}>
<TableCell>{row.date.formatted}</TableCell>
<TableCell>{row.business.name}</TableCell>
<TableCell>{row.user.name}</TableCell>
<TableCell>{row.text}</TableCell>
<TableCell align="right">{row.stars}</TableCell>
</TableRow>
))}
</TableBody>
我到底错过了什么?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。