mirror of
https://bitbucket.org/Mattrixwv/mattrixwvreactcomponents.git
synced 2025-12-06 21:53:57 -05:00
Complete configuration for build
This commit is contained in:
@@ -7,7 +7,7 @@ const themeInitialState: ThemeProviderState = {
|
||||
setTheme: () => null
|
||||
}
|
||||
|
||||
export const ThemeProviderContext = createContext<ThemeProviderState>(themeInitialState);
|
||||
const ThemeProviderContext = createContext<ThemeProviderState>(themeInitialState);
|
||||
|
||||
|
||||
export default function ThemeProvider(props: ThemeProviderProps){
|
||||
@@ -40,7 +40,7 @@ export default function ThemeProvider(props: ThemeProviderProps){
|
||||
localStorage.setItem(storageKey, theme);
|
||||
setTheme(theme);
|
||||
}
|
||||
}), [ theme ]);
|
||||
}), [storageKey, theme]);
|
||||
|
||||
return (
|
||||
<ThemeProviderContext.Provider value={value}>
|
||||
@@ -50,6 +50,7 @@ export default function ThemeProvider(props: ThemeProviderProps){
|
||||
}
|
||||
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export function useTheme(){
|
||||
const context = useContext(ThemeProviderContext);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user