plane/web/components/gantt-chart/hooks/index.tsx

14 lines
347 B
TypeScript
Raw Normal View History

import { useContext } from "react";
// types
import { ChartContextReducer } from "../types";
// context
import { ChartContext } from "../contexts";
export const useChart = (): ChartContextReducer => {
const context = useContext(ChartContext);
if (!context) throw new Error("useChart must be used within a GanttChart");
return context;
};