Тёмный

React Hook Form - useForm: formState 

Beier Luo
Подписаться 3,4 тыс.
Просмотров 36 тыс.
50% 1

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 14   
@danielsousa5611
@danielsousa5611 2 года назад
I just wanna say thank you, Bill. I just get started to use reack form hook with nextjs and I am in love with it. Thank you a lot, It makes my form so much better and clean.
@bluebill1049
@bluebill1049 2 года назад
Thank you! you are welcome.
@AnsgarSteinkamp
@AnsgarSteinkamp 2 года назад
Thank you, Bill! A video about Dependent Fields would be great! (Change of A leads to change of B etc.) Very important in my opinion, and I don't see any possibility to achieve this with React-Hook-Form. Or at least not in a way without lots of re-rendering.
@aleksandrmatyka3118
@aleksandrmatyka3118 2 года назад
The best form library!
@bluebill1049
@bluebill1049 2 года назад
Thank you, Aleksandr!
@aaronmotacek9343
@aaronmotacek9343 Год назад
Just watched your whole playlist, so I can't remember if this is the correct video to comment this question on. If I set defaultValue for "age" field to 0, set its type to be number, and then in the input I use "valueAsNumber", it automatically displays 0 in the field when the component renders. I'd like it to be blank (show an empty field) instead, and also have isDirty be false when the field is empty (or if I type something in, but then delete it to be empty again), but I can't figure out it might be possible to do that appropriately. Is there a way? Or am I not thinking far enough ahead, and that would be a poor/awkward UX overall? I was just thinking it would be nice to have all the fields blank when the user first gets to the form, but maybe that isn't often the case when for most valueAsNumber fields anyway. (And I like the idea of my form values being of the data type I want (i.e. numberAsValue) without having to handle that elsewhere, which is why I was looking into this)
@iury664
@iury664 Год назад
he putted the same defaultVale as register was passing into. How do we now it is working ?
@iury664
@iury664 Год назад
and, when he erased the letter of input the placeholders back normally not because of the defaultValue. The video didn't' show how to use defaultValue...
@grenadier4702
@grenadier4702 2 года назад
Hello. Can you please elaborate on how you managed to update a component through proxy if it subscribed to any form state, i.e. const { isDirty } = formState? For example, I have my Button component, where I destructured the form state like in your example. When some update happens, it goes through proxy's setter, right? And then useState changes? But in this case, I have to rerender my main component that uses useForm which I don't want to happen. Or for isolated render one should use useFormState?
@bluebill1049
@bluebill1049 2 года назад
If you want to isolate the re-render, use useFormState. react-hook-form.com/api/useformstate
@grenadier4702
@grenadier4702 2 года назад
@@bluebill1049 do I correctly undestand that you don't use Proxy object. Instead, you rely on Object.defineProperty?
@bluebill1049
@bluebill1049 2 года назад
@@grenadier4702 We started with Proxy, however it requires polyfill with react native and hence switched to Object.definedProperty, the intension and idea is the same which to detect object property read and start subscription.
@grenadier4702
@grenadier4702 2 года назад
@@bluebill1049 cool, thank you
@flicker3951
@flicker3951 2 года назад
CU KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK
Далее
React Hook Form - Complete Tutorial (with Zod)
28:22
Просмотров 121 тыс.
РЫБКА С ПИВОМ
00:39
Просмотров 521 тыс.
Outsmarted 😂
00:20
Просмотров 2 млн
React Hook Form - useFieldArray
16:59
Просмотров 80 тыс.
Illegal Darts Throws During PDC Matches
8:06
Просмотров 821 тыс.
This New React Hook Changes How You Use Forms
8:34
Просмотров 91 тыс.
The Most Important Design Pattern in React
35:04
Просмотров 74 тыс.
How to Prefill React Hook Form With Data
4:06
Просмотров 53 тыс.
РЫБКА С ПИВОМ
00:39
Просмотров 521 тыс.