const LIGHT_THEME = 'light-theme';
const DARK_THEME = 'dark-theme';
const ThemeContext = React.createContext();
function ThemeWrapper({ children }) {
const [theme, setTheme] = React.useState(LIGHT_THEME);
const applyTheme = (newTheme) => {
document.getElementById('app').className = newTheme;
setTheme(newTheme);
}
return (
<ThemeContext.Provider value={{ theme, applyTheme }}>
{children}
</ThemeContext.Provider>
)
}