reactjs - validateDOMNesting(...) 反应中的警告
问题描述
我想在引导类的帮助下创建一个可折叠的表,我成功地创建了它,但是在控制台中,我收到了这个警告:
validateDOMNesting(...):<div>
不能作为子级出现<td>
我的代码:
<table className="table table-hover order_details_table">
<thead>
<tr>
<th scope="col">Order ID</th>
<th scope="col">Person Name</th>
<th scope="col">Order Date</th>
<th scope="col">Order Amount</th>
</tr>
</thead>
<tbody>
{data?.map((order) => {
return (
<Fragment key={order.id}>
<tr
data-bs-toggle="collapse"
data-bs-target={`#${order.name}`}
aria-expanded="false"
aria-controls={order.name}
>
<th scope="row">{order.id}</th>
<td>{order.name}</td>
<td>{order.date}</td>
<td>{order.amount}</td>
</tr>
<tr>
<td colSpan="4" className="table_collapse">
<div className="collapse" id={order.name}>
<div style={{ padding: "20px" }}>
Some placeholder content for the collapse component. This
panel is hidden by default but revealed when the user
activates the relevant trigger.
</div>
</div>
</td>
</tr>
</Fragment>
);
})}
</tbody>
</table>
现在我的问题是:
1) Is it safe to ignore this warning?
2) If not then what to modify here to fix it?
解决方案
推荐阅读
- firebase - 位置的 Cloud Firestore 规则
- python - 有没有办法访问 Matplotlib 渲染方法并在 Python 中更改它?
- oracle - 更新购买前的 oracle 触发器
- python - 使用 Python 发送电子邮件时出现 AttributeError
- php - 在一个选项卡中上传数据并在下一个选项卡中查看结果
- outlook - 从 Outlook 导出电子邮件 - 主题行中的逗号
- javascript - 如何在角度 8 中为嵌套 JSON 创建模型文件
- circe - 对象 circe 不是包 io 的成员
- c++ - 等差数列与区间的最大重叠
- amazon-web-services - lambda 中的 UpdateFunctionCode 不会更新代码