import { createContext, useContext } from "react"; import { FieldValues, UseFormReturn } from "react-hook-form"; const FormContext = createContext(null!); export const useFormContext = () => { const context = useContext(FormContext); if (!context) { throw new Error("useFormContext must be used within a FormProvider"); } return context as UseFormReturn; }; export default FormContext;