feat: split contexts, providers and hooks

This commit is contained in:
2024-05-30 15:55:59 +02:00
parent 0fd20b90ea
commit edcab95ad7
13 changed files with 51 additions and 41 deletions

9
src/hooks/useApp.ts Normal file
View File

@@ -0,0 +1,9 @@
import { useContext } from "react";
import { AppContext } from "~/context/AppContext";
export const useApp = () => {
const app = useContext(AppContext);
if (!app) throw new Error("`useApp` used outside AppContext");
return app;
};

4
src/hooks/useKitty.ts Normal file
View File

@@ -0,0 +1,4 @@
import { useContext } from "react";
import { KittyContext } from "~/context/KittyContext";
export const useKitty = () => useContext(KittyContext);