1// DarkMode/index.js
2
3const DarkModeToggle = () => {
4 const [isDark, setIsDark] = useState(localStorage.getItem("theme") === "dark" ? true : false);
5 useEffect(() => {
6 document
7 .getElementsByTagName("HTML")[0]
8 .setAttribute("data-theme", localStorage.getItem("theme"));
9 },[]);
10