mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
16 lines
357 B
TypeScript
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;
|
||
|
};
|