plane/web/hooks/store/use-estimate.ts
2023-12-18 16:26:17 +05:30

12 lines
401 B
TypeScript

import { useContext } from "react";
// mobx store
import { StoreContext } from "contexts/store-context";
// types
import { IProjectEstimateStore } from "store/estimate.store";
export const useEstimate = (): IProjectEstimateStore => {
const context = useContext(StoreContext);
if (context === undefined) throw new Error("useCycle must be used within StoreProvider");
return context.estimate;
};