I have a button that toggles dark mode. I store the dark mode state as Boolean in localStorage.
The button invokes this function that should flip the Boolean, but it isn't working.
const handleDarkMode = () => {
let darkMode = localStorage.darkMode
localStorage.setItem("darkMode", !darkMode)
}
Any ideas?
See Question&Answers more detail:os