refactor more hooks

This commit is contained in:
2022-07-25 13:11:40 -04:00
parent 37feb305ff
commit cf106e46da
18 changed files with 246 additions and 296 deletions
+15
View File
@@ -0,0 +1,15 @@
import { useContext } from "react";
import { ThemeContext } from "../contexts/ThemeContext";
// convenience hook to get access to ThemeContext's state/functions from pages/components/etc.
const useTheme = () => {
const context = useContext(ThemeContext);
if (!context) {
throw new Error("useTheme must be used inside of a ThemeProvider.");
}
return context;
};
export default useTheme;