mirror of https://github.com/ctk-hq/ctk
feat: created `useSuperForm` hook
parent
c2d130b011
commit
1c88dc6621
@ -1,3 +1,4 @@
|
||||
export * from "./useTitle";
|
||||
export * from "./useAccordionState";
|
||||
export * from "./useTabContext";
|
||||
export * from "./useSuperForm";
|
||||
|
||||
@ -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;
|
||||
};
|
||||
Loading…
Reference in New Issue