Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

UseFormRegister

Register field into hook form with or without the actual DOM ref. You can invoke register anywhere in the component including at useEffect.

@example
// Register HTML native input
<input {...register("input")} />
<select {...register("select")} />

// Register options
<textarea {...register("textarea", { required: "This is required.", maxLength: 20 })} />
<input type="number" {...register("name2", { valueAsNumber: true })} />
<input {...register("name3", { deps: ["name2"] })} />

// Register custom field at useEffect
useEffect(() => {
  register("name4");
  register("name5", { value: '"hiddenValue" });
}, [register])

// Register without ref
const { onChange, onBlur, name } = register("name6")
<input onChange={onChange} onBlur={onBlur} name={name} />
type UseFormRegister<TFieldValues extends FieldValues> = <TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(name: TFieldName, options?: RegisterOptions<TFieldValues, TFieldName>) => UseFormRegisterReturn<TFieldName>;

§Type Parameters

§
TFieldValues extends FieldValues
[src]

§Type

§
<TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(name: TFieldName, options?: RegisterOptions<TFieldValues, TFieldName>) => UseFormRegisterReturn<TFieldName>
[src]