ThemeProvider nitpicks

This commit is contained in:
Alex Gleason committed 2025-06-01 09:37:49 -05:00
1 parent 7c5fe75572
commit 738b512d9c
4 files changed
+26 -24

No files matched your search

+8 -6
View File
@@ -1,11 +1,13 @@
import { useContext } from "react"
import { ThemeProviderContext } from "@/lib/theme-context"
import { ThemeContext, type ThemeContextType } from "@/lib/ThemeContext"
export const useTheme = () => {
const context = useContext(ThemeProviderContext)
/** Hook to get and set the active theme. */
export function useTheme(): ThemeContextType {
const context = useContext(ThemeContext);
if (context === undefined)
throw new Error("useTheme must be used within a ThemeProvider")
if (!context) {
throw new Error("useTheme must be used within a ThemeProvider");
}
return context
return context;
}