Skip to content

Commit

Permalink
fix(v2): set stored theme only if it exists (#2113)
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 authored and yangshun committed Dec 10, 2019
1 parent ba7c38c commit bbc1d2c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const useTheme = () => {
);
React.useEffect(() => {
try {
setTheme(localStorage.getItem('theme'));
const localStorageTheme = localStorage.getItem('theme');
if (localStorageTheme !== null) {
setTheme(localStorageTheme);
}
} catch (err) {
console.error(err);
}
Expand Down

0 comments on commit bbc1d2c

Please sign in to comment.