Syntax sugar for [react-hook-form](https://react-hook-form.com/) to make it easier to use with controlled components.
npm install hookform-controller-proxySyntax sugar for react-hook-form to make it easier to use with controlled components.
``tsx
import { useForm } from "react-hook-form";
import type { FieldProps } from "hookform-controller-proxy";
import { createControllerProxy } from "hookform-controller-proxy";
interface MyFormData {
foo: string;
bar?: string;
user: User;
}
interface User {
name: string;
}
export function FormExampleApp() {
const form = useForm
const control = createControllerProxy(form);
return (
function TextField({
name,
value,
onChange,
required,
error,
...rest
}: FieldProps
return (
);
}
function UserField({ name, value: user, onChange, error }: FieldProps
return (
);
}
``