import React, { useContext } from "react"; import { FormexController } from "./types"; const FormexContext = React.createContext | null>(null); export const useFormex = () => { const ctx = useContext(FormexContext); if (!ctx) throw new Error("useFormex must be used within a Formex provider"); return ctx as FormexController; }; export const Formex = ({ value, children }: { value: FormexController, children: React.ReactNode }) => { return {children}; };