meta-front-end-developer-professional-certificate icon indicating copy to clipboard operation
meta-front-end-developer-professional-certificate copied to clipboard

Advance React - Week 1 - Create a light-dark theme switcher

Open Monik2002 opened this issue 1 year ago • 0 comments

image

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;

Monik2002 avatar Jan 05 '24 19:01 Monik2002