feat: split contexts, providers and hooks
This commit is contained in:
9
src/hooks/useApp.ts
Normal file
9
src/hooks/useApp.ts
Normal 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
4
src/hooks/useKitty.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import { useContext } from "react";
|
||||
import { KittyContext } from "~/context/KittyContext";
|
||||
|
||||
export const useKitty = () => useContext(KittyContext);
|
||||
Reference in New Issue
Block a user