Closed
Description
React version: 18
Steps To Reproduce
- Clone https://github.com/Avansai/next-multilingual
- run: npm install
- run: npm build
- run: npm run start-example-build
- Go to the following URL: http://localhost:3000/fr-ca/tests/routes-dynamiques/123
- Open the console log: no errors
- Kill the app, and update the react and react-dom package to version 18.0
- Re-run steps 2 to 5
- Open the console log: lots of hydration errors #425, #418 and #423.
Link to code example:
https://github.com/Avansai/next-multilingual
The current behavior
Using React 18, the tests are failing because of the errors being thrown in the console.
I confirmed this was related to suppressHydrationWarning
because as soon as I removed the following code from: https://github.com/Avansai/next-multilingual/blob/main/example/pages/tests/dynamic-routes/%5Bid%5D.tsx#L37
<tr>
<td>{messages.format('rowLocalizedWithAsPath')}</td>
{/* Adding `suppressHydrationWarning` until
https://github.com/vercel/next.js/issues/32772 is resolved */}
<td suppressHydrationWarning={true}>{asPath}</td>
</tr>
The errors stop. However, I could not find any mention that suppressHydrationWarning
was no longer supported with React 18 and these errors are only triggered on builds, not in dev mode (which is why I am opening this issue)
The expected behavior
suppressHydrationWarning
should prevent these errors from being thrown.