From a5f07116f1d94f6a0491ffb983d76723f4ac5090 Mon Sep 17 00:00:00 2001 From: Bochkovskyi Date: Sun, 1 Oct 2023 20:43:15 +0300 Subject: [PATCH 1/2] Move useEffect --- src/store/theme-context.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/store/theme-context.jsx b/src/store/theme-context.jsx index 521dc09..adfcace 100644 --- a/src/store/theme-context.jsx +++ b/src/store/theme-context.jsx @@ -10,10 +10,6 @@ export const ThemeContext = createContext({ export default function ThemeProvider({ children }) { const [currentTheme, setCurrentTheme] = useState('light') - useEffect(() => { - checkTheme() - }, [checkTheme, currentTheme]) - const checkTheme = useCallback(() => { const isDarkPreferred = window.matchMedia( '(prefers-color-scheme: dark)' @@ -38,6 +34,10 @@ export default function ThemeProvider({ children }) { setCurrentTheme(next) }, []) + useEffect(() => { + checkTheme() + }, [checkTheme, currentTheme]) + return ( Date: Thu, 30 Nov 2023 12:24:43 +0200 Subject: [PATCH 2/2] update @types/react --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index bd29389..b67a10a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "my-app", + "name": "golub", "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "my-app", + "name": "golub", "version": "0.0.1", "dependencies": { "next": "14.0.3", @@ -14,7 +14,7 @@ }, "devDependencies": { "@types/node": "^20", - "@types/react": "^18", + "@types/react": "^18.2.39", "@types/react-dom": "^18", "autoprefixer": "^10.0.1", "cspell": "^7.3.8", diff --git a/package.json b/package.json index b94c038..e2eef26 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ }, "devDependencies": { "@types/node": "^20", - "@types/react": "^18", + "@types/react": "^18.2.39", "@types/react-dom": "^18", "autoprefixer": "^10.0.1", "cspell": "^7.3.8",