Last active
August 12, 2019 18:06
-
-
Save djD-REK/0e0b87283953a02504d5a7d8d243c6a4 to your computer and use it in GitHub Desktop.
Used in the Medium article: Dark Mode for ANY React App 2019: Part 1 of a Series on Day/Night Toggles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import useDarkMode from "use-dark-mode"; // Don't forget to import the NPM package use-dark-mode | |
function darkModeToggleButton() { | |
const darkMode = useDarkMode(false); | |
return (<button onClick={darkMode.toggle}>Toggle Day / Night</button>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment