import { FieldValues, Path, useController, useFormContext, useWatch, } from "react-hook-form"; export function CheckboxesGroup({ options, name, }: { options: string[]; name: Path; }) { const { control } = useFormContext(); const { field: { ref, onChange, ...inputProps }, } = useController({ control, name }); const values: string[] = useWatch({ control, name }); return (
{options.map((option) => ( ))}
); }