diff --git a/services/frontend/src/hooks/index.ts b/services/frontend/src/hooks/index.ts index 78bf33e..016156e 100644 --- a/services/frontend/src/hooks/index.ts +++ b/services/frontend/src/hooks/index.ts @@ -1,3 +1,4 @@ export * from "./useTitle"; export * from "./useAccordionState"; export * from "./useTabContext"; +export * from "./useSuperForm"; diff --git a/services/frontend/src/hooks/useSuperForm.ts b/services/frontend/src/hooks/useSuperForm.ts new file mode 100644 index 0000000..bd2d206 --- /dev/null +++ b/services/frontend/src/hooks/useSuperForm.ts @@ -0,0 +1,12 @@ +import { useContext } from "react"; +import { SuperFormContext } from "../contexts"; +import { ISuperFormContext } from "../types"; + +export const useSuperForm = (): ISuperFormContext => { + const context = useContext(SuperFormContext); + if (!context) { + throw new Error("Cannot find super form context!"); + } + + return context; +};