How to set the value without triggering the watch? #8542
-
I would like to separate the processing between the changes made by programs such as setValue and reset and the changes made by user input. Do you have a good idea? const {watch, setValue} = useForm();
useEffect(() => {
// I want to handle only user-input changes
watch(value => console.log(value));
}, [watch]);
const action = () => {
// I don't want to trigger watch in this case
setValue('foo', 'baa');
} |
Beta Was this translation helpful? Give feedback.
Answered by
bluebill1049
Jun 22, 2022
Replies: 2 comments 4 replies
-
can you check the event type which returned by the watch? |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
dninomiya
-
I have the same question, but I use the hook |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can you check the event type which returned by the watch?