const onThemeToggleHandler = (theme, setTheme) => {
setTheme(theme == 'theme-dark' ? 'theme-light' : 'theme-dark')
}
const [theme, setTheme] = useState('theme-dark')
useEffect(() => {
document.querySelector('.App').classList.toggle(theme)
}, [theme])
useEffect(() => { document.querySelector('.App').classList.toggle(theme) }, [theme])
useEffect(() => {
const el = document.querySelector('.App');
el.classList.add(theme);
return () => el.classList.remove(theme);
}, [ theme ]);