add files
This commit is contained in:
1 parent
2cb39f0c55
commit
ab9dfff33f
1 file changed
+17
@@ -0,0 +1,17 @@
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
const ThemeContext = createContext(null);
|
||||
|
||||
function ThemeProvider({ value, children }) {
|
||||
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
|
||||
}
|
||||
|
||||
function useTheme() {
|
||||
const context = useContext(ThemeContext);
|
||||
if (!context) {
|
||||
throw new Error("useTheme must be used within ThemeProvider.");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
export { ThemeProvider, useTheme };
|
||||
Reference in new issue
Block a user