plane/web/components/gantt-chart/hooks/use-gantt-chart.ts

12 lines
421 B
TypeScript
Raw Normal View History

import { useContext } from "react";
// mobx store
2024-03-19 14:38:35 +00:00
import { GanttStoreContext } from "@/components/gantt-chart/contexts";
// types
2024-03-19 14:38:35 +00:00
import { IGanttStore } from "@/store/issue/issue_gantt_view.store";
export const useGanttChart = (): IGanttStore => {
const context = useContext(GanttStoreContext);
if (context === undefined) throw new Error("useGanttChart must be used within GanttStoreProvider");
return context;
};