import { Controller, useFormContext } from 'react-hook-form'; import { FieldError } from './FieldError'; type Props = { name: string; label: string; hint?: string; }; export function ToggleField({ name, label, hint }: Props) { const { control } = useFormContext(); return ( { const on = !!field.value; return (
{hint && ( {hint} )}
); }} /> ); }