import { useFormContext } from "react-hook-form"; export function SelectInput({ name, label = "Label", autocomplete = "off", placeholder = "", options, required, }: { name: string; label: string | undefined; autocomplete?: string | undefined; placeholder?: string | undefined; options: string[]; required: boolean; }) { const { register, formState: { errors }, } = useFormContext(); // retrieve all hook methods return ( <> {errors?.[name] && errors[name].message} ); }