Answers for "dark mode reactjs tutorial"

0

dark mode with react hooks

// DarkMode/index.js

const DarkModeToggle = () => {
  const [isDark, setIsDark] = useState(localStorage.getItem("theme") === "dark" ? true : false);
  useEffect(() => {
    document
    .getElementsByTagName("HTML")[0]
    .setAttribute("data-theme", localStorage.getItem("theme"));
  },[]);
Posted by: Guest on October-31-2020
0

react dark mode npm

$ npm i use-dark-mode
Posted by: Guest on April-28-2020

Code answers related to "Swift"

Browse Popular Code Answers by Language