golem-flask-backend / src /components /theme-provider.tsx
mememechez's picture
Deploy final cleaned source code
ca28016
raw
history blame
576 Bytes
"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>
}