Next.js Discord

Discord Forum

NextJs need to solve that!

Unanswered
Argente Brun posted this in #help-forum
Open in Discord
Argente BrunOP
Next.js 13 consistently encounters unnecessary errors, and at times, I struggle to pinpoint their origins.

4 Replies

you can't put a div inside span
Original message was deleted
can i ask how this is a relevant comment for helping the OP?
Hydration errors can occur from:

Incorrect nesting of HTML tags
<p> nested in another <p> tag <div> nested in a <p> tag

Possible Ways to Fix It
1. Disabling SSR on specific components
import dynamic from 'next/dynamic' const NoSSR = dynamic(() => import('../components/no-ssr'), { ssr: false }) export default function Page() { return ( <div> <NoSSR /> </div> ) }

2. Using suppressHydrationWarning
Sometimes content will inevitably differ between the server and client, such as a timestamp. You can silence the hydration mismatch warning by adding suppressHydrationWarning={true}to the element.
<html lang="en"> <body suppressHydrationWarning={true}> {children} </body> </html>

For more Details : https://nextjs.org/docs/messages/react-hydration-error?trk=public_post_comment-text