[英]Text nodes cannot appear as a child of <tbody>
My code is really simple and I checked everything but this is getting this error repeatedly.我的代码非常简单,我检查了所有内容,但这反复出现此错误。 Please suggest to me what can i change.请向我建议我可以改变什么。 I tried using but that dint work.I even checked other answers but they dint work.我尝试使用,但效果很好。我什至检查了其他答案,但效果很好。
import React from "react";
import { Button, Table } from "react-bootstrap";
import "bootstrap/dist/css/bootstrap.min.css";
import Employees from "./Employees";
const Home = () => {
return (
<>
<div>
<Table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
{Employees && Employees > 0 ? Employees.map((item) => {
return (
<tr key={item.id}>
<td>{item.name}</td>
<td>{item.age}</td>
</tr>
);
})
: "No data available"}
</tbody>
</Table>
</div>
</>
);
};
export default Home;
If there is no data your table would look like如果没有数据,您的表格将如下所示
<table>
<tbody>
No data available
</tbody>
</table>
It needs to have a <tr>
and a <td>
它需要有一个<tr>
和一个<td>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.