We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e3e0024 commit b1c4a74Copy full SHA for b1c4a74
packages/docs/src/App.js
@@ -34,10 +34,15 @@ const App = () => {
34
const [menuVisible, setMenuVisibility] = React.useState(false)
35
const [locationKey, setLocationKey] = React.useState()
36
37
- const [theme, setTheme] = React.useState('light')
+ const defaultTheme = window.localStorage.getItem('theme') || 'light'
38
+ const [theme, setTheme] = React.useState(defaultTheme)
39
40
document.querySelector('#favicon').href = `favicon-${theme}.png`
41
42
+ React.useEffect(() => {
43
+ window.localStorage.setItem("theme", theme);
44
+ },[theme])
45
+
46
React.useEffect(() => {
47
setMenuVisibility(false)
48
}, [locationKey])
0 commit comments