Next.js Discord

Discord Forum

Hydration error on static home page

Unanswered
English Lop posted this in #help-forum
Open in Discord
Avatar
English LopOP
I created a Next app with create-next-app and simply added Clerk Provider to my layout.jsx. When I load localhost:3000, I get hydration error. Here is my code:
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import { ClerkProvider } from "@clerk/nextjs";

const geistSans = localFont({
  src: "./fonts/GeistVF.woff",
  variable: "--font-geist-sans",
  weight: "100 900",
});
const geistMono = localFont({
  src: "./fonts/GeistMonoVF.woff",
  variable: "--font-geist-mono",
  weight: "100 900",
});

export const metadata: Metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <ClerkProvider>
      <html lang="en">
        <body
          className={`${geistSans.variable} ${geistMono.variable} antialiased`}
        >
          {children}
        </body>
      </html>
    </ClerkProvider>
  );
}
Image

9 Replies

Avatar
What happens if you move the provider in the body?
Have you tried the supressHydrationError prop yet
Avatar
@English Lop have you tried?
Avatar
English LopOP
Thanks for your reply
I decided to use an open source library
But yes, that solved it
Avatar
great to hear that!
Avatar
@English Lop But yes, that solved it
Avatar
mark solution to close this thread 🙂