Capítulo 24 de 39
trigger(name?, { shouldFocus? }) manually runs validation without submitting — returns Promise<boolean> resolving true if the targeted field(s) pass — useful for dependent-field validation and custom validate-on-demand flows.
ref, not a custom/virtual registration.trigger() with no arguments re-renders the entire form's state.Promise<boolean> — awaitable, so you can branch logic on whether validation passed.const isValid = await trigger("firstName") // single field, isolated re-render
await trigger(["firstName", "lastName"]) // multiple fields, whole-form re-render
await trigger() // everything, whole-form re-render
trigger("name", { shouldFocus: true }) // focus on failure
shouldFocus for a field registered without a real DOM ref: it silently does nothing.trigger is the on-demand validation entry point outside of a real submit — commonly used for dependent-field checks.register's deps option triggers this automatically for dependent fields on that field's own validation, but not on a manual trigger() call.errors/isValid land.