|
I'm really confused.
The following is available in the context:
Why does scenario 2 below rerender all the time? In scenario 1, I'm using The simple solution is of course to use
Scenario 1: Scenario 2: |
Replies: 3 comments 12 replies
|
Whenever you're subscribed to root level state like
You don't always want to wrap fields in a component to access some nested field's value at top form level. Example CSB |
|
=================== ✅ useWatch vs watch in React Hook Form ============================ Performance-friendly: Ideal for large forms where you only want to re-render specific components based on certain field changes.
Better for one-time reads (e.g., inside useEffect) but not for reactive rendering. Not scoped, so it listens globally inside the form context. 🔁 Important Note About Using in useEffect So: ie ie ❌ Wrong Pattern (reactive dependencies cause infinite loop) ✅ Correct pattern with useWatch: |

Whenever you're subscribed to root level state like
formState, form values (watch)You can always consider hooks alternatives like
useFormState, useWatch.You don't always want to wrap fields in a component to access some nested field's value at top form level.
Example CSB
You can switch on component render highlights in devtools for convenience