mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
15 lines
415 B
TypeScript
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;
|