Skip to content

Commit

Permalink
docs(www): mention to add suppressHydrationWarning in the dark mode d…
Browse files Browse the repository at this point in the history
…ocs for next

User have repeatedly run into hydration errors because they don't read the next-themes readme and don't pay attention to the shadcn/ui docs and miss that the `suppressHydrationWarning` prop must be added.

This commit mentions this explicitly and highlights the line in the snippet (as well as fixing the previously wrong highlighting).
  • Loading branch information
ChristianIvicevic authored Nov 20, 2024
1 parent 805ed41 commit c41eee0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/www/content/docs/dark-mode/next.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ export function ThemeProvider({

### Wrap your root layout

Add the `ThemeProvider` to your root layout.
Add the `ThemeProvider` to your root layout and add the `suppressHydrationWarning` prop to the `html` tag.

```tsx {1,9-11} title="app/layout.tsx"
```tsx {1,6,9-14,16} title="app/layout.tsx"
import { ThemeProvider } from "@/components/theme-provider"

export default function RootLayout({ children }: RootLayoutProps) {
Expand Down

0 comments on commit c41eee0

Please sign in to comment.