Compare commits
No commits in common. "main" and "darkmode" have entirely different histories.
@ -1,17 +0,0 @@
|
|||||||
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 };
|
|
||||||
Loading…
x
Reference in New Issue
Block a user