plane/web/hooks/store/use-project-view.ts
2023-12-15 17:01:36 +05:30

12 lines
420 B
TypeScript

import { useContext } from "react";
// mobx store
import { MobxStoreContext } from "lib/mobx/store-provider";
// types
import { IProjectViewStore } from "store/project-view.store";
export const useProjectView = (): IProjectViewStore => {
const context = useContext(MobxStoreContext);
if (context === undefined) throw new Error("useMobxStore must be used within MobxStoreProvider");
return context.projectView;
};