meta-front-end-developer-professional-certificate
meta-front-end-developer-professional-certificate copied to clipboard
Advance React - Week 1 - Create a light-dark theme switcher
The corrected code under Switch/index.js -
import "./Styles.css"; import { useTheme } from "../ThemeContext";
const Switch = () => { const { theme , toggleTheme } = useTheme(); return ( <label className="switch"> <input type="checkbox" checked={theme === "light"} onchange = {toggleTheme} /> <span className="slider round" /> ); };
export default Switch;