plane/god-mode/hooks/use-instance.tsx
2024-02-15 12:21:39 +05:30

15 lines
415 B
TypeScript

import { useContext } from "react";
// mobx store
import { InstanceContext } from "lib/instance-provider";
// types
import { IInstanceStore } from "store/instance.store";
const useInstance = (): IInstanceStore => {
const context = useContext(InstanceContext);
if (context === undefined)
throw new Error("useInstance must be used within InstanceProvider");
return context;
};
export default useInstance;