'use client'
import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"

export default function ThemeProvider({children}:{children: React.ReactNode}) {
  const [mounted,setMounted] = React.useState(false)
  React.useEffect(() => {
    setMounted(true)
  })
  if (mounted) {
    return (
      <NextThemesProvider attribute="class" defaultTheme="dark">
        {children}
       </NextThemesProvider>
     )
  } else {
    return (
      <>
        {children}
      </>
    )
  }
}
