目前大多發生在React 18的版本
Hydration failed because the initial UI does not match what was rendered on the server
Text content does not match server-rendered HTML.
There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.
import dynamic from 'next/dynamic'
const Table = dynamic(() => import("/design-systems/Molecules/Table"), {
ssr: false,
});
不正確:
<table>
<tr>
<td>a</td>
<td>b</td>
</tr>
</table>
正確的:
<table>
<tbody>
<tr>
<td>a</td>
<td>b</td>
</tr>
</tbody>
</table>
這部分屬於最近執行create-next-app後會自動將React 直升18而產生出的問題,
在此提供給各位注意