commerce/site/lib/hooks/useToggleTheme.ts
2022-11-30 00:29:08 +02:00

11 lines
329 B
TypeScript

import { useTheme } from 'next-themes'
import { useEffect, useState } from 'react'
export const useToggleTheme = () => {
const { theme, themes, setTheme } = useTheme()
const [themeValue, setThemeValue] = useState<string>()
useEffect(() => setThemeValue(theme), [theme])
return { theme: themeValue, setTheme, themes }
}