tldraw/hooks/useStateTheme.ts
2021-07-14 09:04:07 +01:00

11 lines
286 B
TypeScript

import { useTheme } from 'next-themes'
import { useEffect } from 'react'
import state from 'state'
export default function useStateTheme(): void {
const { theme } = useTheme()
useEffect(() => {
state.send('CHANGED_DARK_MODE', { isDarkMode: theme === 'dark' })
}, [theme])
}