import { useTheme } from 'next-themes'; import React from 'react'; const ThemeSwitch = (): JSX.Element => { const [mounted, setMounted] = React.useState(false); const { theme, setTheme } = useTheme(); // After mounting, we have access to the theme React.useEffect(() => setMounted(true), []); if (!mounted) { return null; } const isDark = theme === 'dark'; const color = isDark ? '#fff' : '#000'; const maskColor = isDark ? '#000' : '#fff'; return ( ); }; export default ThemeSwitch;