|
1
|
import { useContext } from "react" |
|
2
|
import { ThemeContext } from "./theme-context" |
|
3
|
|
|
4
|
export const useTheme = () => { |
|
5
|
const context = useContext(ThemeContext) |
|
6
|
if (!context) { |
|
7
|
throw new Error("useTheme must be used within a ThemeProvider") |
|
8
|
} |
|
9
|
return context |
|
10
|
} |