We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 072d53f commit 5f0bdd6Copy full SHA for 5f0bdd6
src/contexts/MainContextProvider/index.jsx
@@ -1,8 +1,10 @@
1
import React, { useReducer, createContext } from 'react';
2
import MainReducer from '../../reducers/MainReducer';
3
4
-const themeIndex = localStorage.themeIndex ? parseFloat(localStorage.themeIndex) : 0;
5
-const themeColorIndex = localStorage.themeColorIndex ? parseFloat(localStorage.themeColorIndex) : 0;
+const themeIndex = typeof window !== 'undefined' && localStorage.themeIndex ? parseFloat(localStorage.themeIndex) : 0;
+const themeColorIndex = typeof window !== 'undefined' && localStorage.themeColorIndex
6
+ ? parseFloat(localStorage.themeColorIndex)
7
+ : 0;
8
9
const initState = {
10
pageIndex: 0,
0 commit comments