Spaces:
Runtime error
Runtime error
| "use client" | |
| import * as React from "react" | |
| import { ThemeProvider as NextThemesProvider } from "next-themes" | |
| import { type ThemeProviderProps } from "next-themes/dist/types" | |
| export function ThemeProvider({ children, ...props }: ThemeProviderProps) { | |
| const [mounted, setMounted] = React.useState(false) | |
| React.useEffect(() => { | |
| setMounted(true) | |
| }, []) | |
| // Prevent hydration mismatch by not rendering theme-sensitive content until mounted | |
| if (!mounted) { | |
| return <>{children}</> | |
| } | |
| return <NextThemesProvider {...props}>{children}</NextThemesProvider> | |
| } | |