Next.js Discord

Discord Forum

Hydration Error with Next.js 15 and ShadCN UI Theme Installation

Answered
Samar Hayat posted this in #help-forum
Open in Discord
Avatar
Hi everyone,
I'm encountering a hydration error in my Next.js 15 app. The error message states:
Hydration failed because the server rendered HTML didn't match the client. This can happen if a SSR-ed Client Component used...

I've tried the following solutions:

Tested the issue with a new profile and no extensions.
Added the suggested meta tag:
<meta name="format-detection" content="telephone=no, date=no, email=no, address=no" />

However, the issue persists.
Also, I'm using ShadCN UI for theme installation, and the problematic code includes:

className="light"
style={{ color-scheme: "light" }}

Can someone please suggest a solution to fix this hydration issue? Any help would be greatly appreciated!
Image
Answered by Yi Lon Ma
You didn't follow the complete guide to setup themeing
View full answer

4 Replies

Avatar
You didn't follow the complete guide to setup themeing
Answer
Avatar
you're supposed to add suppressHydrationWarning prop to <html> tag
Avatar