React Hook Form - useForm: resetField

preview_player
Показать описание
This session cover resetField API inside react hook form.

Рекомендации по теме
Комментарии
Автор

Hey Bill, thank you for the videos, the world really needs them )

Ernuna
Автор

Just wanted to say this came in handy recently, thanks for the vids!

NukaColaBear
Автор

I have a use case that is not covered by neither this video nor the setValue one.

My use case is that I want to reset a field that is valid, but I want then to trigger a validation. I have found a solution for that but it seems like a "hack":

form.setValue("id", 0, {
shouldDirty: true,
shouldTouch: true,
shouldValidate: true,
});
form.trigger("id");
if I don't do the trigger, the dirty flag is not set to false.
I think we should have a shouldValidate in the resetField function.

ganbin
join shbcf.ru