Skip to content

Commit

Permalink
fix errors in console
Browse files Browse the repository at this point in the history
  • Loading branch information
alexasselin008 committed Dec 11, 2024
1 parent d09b8d6 commit a67bbd5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions apps/docs/context/theme/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export const ThemeContext = createContext<ColorSchemeContextType>({
});

export const ThemeProvider = ({ children }: ThemeProviderProps) => {
const [colorMode, setColorMode] = useState<ColorScheme | undefined>(
undefined
);
const [colorMode, setColorMode] = useState<ColorScheme>(() => getInitialColorMode());

useEffect(() => {
if (colorMode) {
Expand All @@ -32,12 +30,12 @@ export const ThemeProvider = ({ children }: ThemeProviderProps) => {
}
}, [colorMode]);

useEffect(() => {
setColorMode (getInitialColorMode());
}, [setColorMode ]);

return (
<ThemeContext.Provider value={{ colorMode, setColorMode }}>
<ThemeContext.Provider value={{
colorMode: colorMode,
setColorMode
}}
>
{children}
</ThemeContext.Provider>
);
Expand Down

0 comments on commit a67bbd5

Please sign in to comment.