Skip to content

watch() vs useWatch() #7558

Answered by Moshyfawn
msageryd asked this question in Q&A
Jan 17, 2022 · 2 comments · 8 replies
Discussion options

You must be logged in to vote

What other functions from useForm will behave like watch and trigger rerenders?

Whenever you're subscribed to root level state like formState, form values (watch)
You can always consider hooks alternatives like useFormState, useWatch.

Whats the point with a subscription for a specific field if I'm getting rerenders even if the fieldValue hasn't changed?

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

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
7 replies
@Moshyfawn
Comment options

@bluebill1049
Comment options

@nvmnghia
Comment options

@rygiewicz-samsung
Comment options

@timkindberg
Comment options

Comment options

You must be logged in to vote
1 reply
@msageryd
Comment options

Answer selected by bluebill1049
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants