plane/web/hooks/store/use-project-view.ts

12 lines
409 B
TypeScript
Raw Normal View History

2023-12-15 11:31:36 +00:00
import { useContext } from "react";
// mobx store
import { StoreContext } from "contexts/store-context";
2023-12-15 11:31:36 +00:00
// types
import { IProjectViewStore } from "store/project-view.store";
export const useProjectView = (): IProjectViewStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useProjectView must be used within StoreProvider");
2023-12-15 11:31:36 +00:00
return context.projectView;
};