Reputation:
I have a Cookiebot Script that i am including at the top of of the in my Root Layout Component.
Now when i am initially loading the page, the Cookiebot Banner shows up and works. But if i am not declining or accepting, so not clicking anything and then reload the page i get an Hydration Error in the console and the Cookiebot Script does not show up anymore. If i remove the Cookiebot Script the Error does not happen anymore.
'use client'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<head>
<script id="Cookiebot" src="https://consent.cookiebot.com/uc.js" data-cbid="COOKIEBOT_ID" type="text/javascript" async></script>
…the rest of the code
</head>
</html>
)
}
These are the Errors:
<noscript>
in <div>
.<#document>
.Edit:
Upvotes: 1
Views: 449
Reputation: 142
Synchronous scripts should not be used. See: https://nextjs.org/docs/messages/no-sync-scripts
Upvotes: -1