Last active
June 18, 2021 23:56
-
-
Save vzhou842/88ba79c9533e0bc16b9b89913e4ee6a8 to your computer and use it in GitHub Desktop.
Saved Theme Preference
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
// Save this at some point | |
localStorage.setItem('preferred-theme', 'dark'); | |
// User can close the tab, quit the browser, etc... | |
// Come back later and this will still be set | |
const theme = localStorage.getItem('preferred-theme'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment