plane/web/components/gantt-chart/hooks/index.tsx
sriram veeraghanta 3ce0aa8ebc restructring
2023-08-22 13:00:23 +05:30

16 lines
357 B
TypeScript

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;
};