The code returns the following error:
A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
- A server/client branch `if (typeof window !== 'undefined')`.
- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.
- Date formatting in a user's locale which doesn't match the server.
- External changing data without sending a snapshot of it along with the HTML.
- Invalid HTML tag nesting.
It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
https://react.dev/link/hydration-mismatch
...
<HotReload globalError={[...]} webSocket={WebSocket} staticIndicatorState={{pathname:null, ...}}>
<AppDevOverlayErrorBoundary globalError={[...]}>
<ReplaySsrOnlyErrors>
<DevRootHTTPAccessFallbackBoundary>
<HTTPAccessFallbackBoundary notFound={<NotAllowedRootHTTPFallbackError>}>
<HTTPAccessFallbackErrorBoundary pathname="/" notFound={<NotAllowedRootHTTPFallbackError>} ...>
<RedirectBoundary>
<RedirectErrorBoundary router={{...}}>
<Head>
<__next_root_layout_boundary__>
<SegmentViewNode type="layout" pagePath="layout.tsx">
<SegmentTrieNode>
<link>
<script>
<script>
<RootLayout>
<html lang="id">
<head>
<body
className="plus_jakarta_sans_75580a06-module__h4idsq__variable playfair_display_fed1534a-m..."
- data-new-gr-c-s-check-loaded="14.1275.0"
- data-gr-ext-installed=""
>
...
at body (<anonymous>)
at RootLayout (app/layout.tsx:127:7)
125 | />
126 | </head>
> 127 | <body
| ^
128 | className={`${plusJakarta.variable} ${playfair.variable} font-sans antialiased`}
129 | >
130 | {children} (<anonymous>)
Revise the code to address the error.
The hydration mismatch is caused by a browser extension (Grammarly) injecting data-new-gr-c-s-check-loaded and data-gr-ext-installed attributes onto the <body> tag after server rendering. The fix is to add suppressHydrationWarning to both <html> and <body> so React ignores these attribute differences.
Added suppressHydrationWarning to both the <html> and <body> elements in layout.tsx. This tells React to ignore attribute-level mismatches on those tags, which resolves the hydration error caused by the Grammarly browser extension injecting its own data-gr-* attributes into the DOM before React hydrates. This is the standard recommended fix for extension-caused hydration mismatches and does not affect the rendering of your app.
You can send messages while the preview loads