reactjs - 警告:列表中的每个孩子都应该有一个唯一的“关键”道具 - 与 next.js 反应
问题描述
有人告诉我这个问题是因为我可能<> </>
在 map 函数中有这个标签,这是错误的主要原因,但事实并非如此,我仍然有这个问题,让我展示一下
现在,让我展示一些代码
<SearchResults>
{results === "" ? (
<NoSearch>No hay búsquedas recientes</NoSearch>
) : (
<>
{filteredUsers.length > 0 ? (
<>
{filteredUsers.map(user => {
return (
<DisplayUsers
key={user.id}
whileHover={{
backgroundColor: "rgba(0, 0, 0, 0.08)",
borderRadius: "1.2rem"
}}
>
<DisplayPhoto>
{user.perfil ? (
<img src={user.perfil} alt="" />
) : (
<DefaultUser
style={{
width: "38px",
height: "38px",
borderRadius: "50%"
}}
/>
)}
</DisplayPhoto>
<DisplayName>
<h2>{user.name}</h2>
{/* <p>Amig@</p> */}
</DisplayName>
</DisplayUsers>
);
})}
</>
) : (
<NoSearch>No hay resultados</NoSearch>
)}
</>
)}
</SearchResults>
如果我把钥匙放在主容器中,为什么我仍然有这个问题?
如果你能帮助我,你是最伟大的,谢谢!!
解决方案
推荐阅读
- java - 连接丢失后,Hibernate 自动与 sql-server 重新连接
- php - 如何在 127.0.0.1/ 上访问不带扩展名的 .html 或 .php 文件
- r - 如何在 pca biplot 中显示观察结果?
- ios - 编译器不支持此 SDK。请选择与 SDK 匹配的工具链
- android - 捏放大/缩小和移动/拖动ImageView离开屏幕android
- java - 如何以编程方式重命名 .Java 文件中的字段、参数、类名和方法名?
- angular - 是否可以显示选择初始值的角度材料的多选组件?
- javascript - 如何过滤获取的 JSON 数据?
- html - ValueError:通过了 60 列,传递的数据有 282 列
- python - 处理对象方法的Python3多处理池未获取对象的更新数据