Skip to content

Commit

Permalink
fix hydration error
Browse files Browse the repository at this point in the history
  • Loading branch information
LoV432 committed Nov 4, 2023
1 parent dd08d09 commit bf6c0af
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ function ConnectionLogsList({
}: {
connectionLogsList: allConnectionStatusType;
}) {
let listBody = () => {
return connectionLogsList.map((status) => {
return (
const [connectionLogsListBody, setConnectionLogsListBody] = useState<
JSX.Element[]
>([]);
let listBody: JSX.Element[] = [];
useEffect(() => {
connectionLogsList.forEach((status) => {
listBody.push(
<tr className="border-slate-300 border-opacity-30" key={status.id}>
<th>{status.id}</th>
<td>
Expand All @@ -99,7 +103,8 @@ function ConnectionLogsList({
</tr>
);
});
};
setConnectionLogsListBody(listBody);
}, []);
return (
<div className="overflow-x-auto">
<table className="table table-zebra">
Expand All @@ -110,7 +115,7 @@ function ConnectionLogsList({
<th>Time</th>
</tr>
</thead>
<tbody>{listBody()}</tbody>
<tbody>{connectionLogsListBody}</tbody>
</table>
</div>
);
Expand Down

0 comments on commit bf6c0af

Please sign in to comment.