Custom hook to access the theme context.
If used outside of a ThemeProvider.
export const useTheme = (): ThemeContextType => { const context = useContext(ThemeContext); if (context === undefined) { throw new Error("useTheme must be used within a ThemeProvider"); } return context;}; Copy
export const useTheme = (): ThemeContextType => { const context = useContext(ThemeContext); if (context === undefined) { throw new Error("useTheme must be used within a ThemeProvider"); } return context;};
The current theme context value.
Custom hook to access the theme context.
Throws
If used outside of a ThemeProvider.
Source