From 3d8d71bfafd63d2be45f010497139c0f324e8c7a Mon Sep 17 00:00:00 2001 From: saurabh-rana17 Date: Thu, 10 Oct 2024 21:49:02 +0530 Subject: [PATCH] removed unncecessary comments --- src/Context/themeContext.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Context/themeContext.js b/src/Context/themeContext.js index 7117eeb..16e6de1 100644 --- a/src/Context/themeContext.js +++ b/src/Context/themeContext.js @@ -20,18 +20,16 @@ const getInitialTheme = () => { export function ThemeProvider({ children }) { const [theme, setTheme] = useState(getInitialTheme()); - // Handling theme change + // Handle theme change const changeTheme = () => { const newTheme = theme.mode === "light" ? dark : light; setTheme(newTheme); }; - // Updating localStorage whenever the theme changes useEffect(() => { localStorage.setItem("theme", JSON.stringify(theme)); }, [theme]); - // Memoizing the context value to avoid unnecessary re-renders const contextValue = useMemo(() => ({ theme, changeTheme }), [theme]); return (