Capítulo 22 de 39
setValues(value, options?) (7.74.0+) updates several fields in one batched re-render — either from a plain partial-values object, or a callback deriving the next values from the current ones.
Partial<TFieldValues> object, or (currentValues) => nextValues callback.setValue several times in sequence.defaultValues — use reset if you need to reinitialize the baseline.shouldValidate/shouldDirty/shouldTouch/delayError (7.82.0+, requires shouldValidate: true) knobs as setValue, applied across all updated fields.setValues({ firstName: "Bill", lastName: "Luo" })
setValues((data) => ({ ...data, name: "test" })) // derive from current values
setValues(
{ firstName: "Bill", lastName: "Luo" },
{ shouldValidate: true, shouldDirty: true, shouldTouch: true }
)
setValue repeatedly instead of setValues when updating several fields together: causes multiple re-renders instead of one batched update.setValues to reinitialize defaultValues: it only writes current values; use reset for that.setValues is setValue for multiple fields at once, batched into one re-render.defaultValues.