Difference between setValue and onChange when applying input mask with react-hook-form in React Native #11926
Unanswered
BarbieriMatheus
asked this question in
Q&A
Replies: 2 comments
-
I also see the recommended from official documentation. However, some cases I need to use setValue method to set/update value due to business but sometimes it doesn't work as expected and has to be controlled via useEffect. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@bluebill1049 Would you have some guidance to offer in that regard? And thanks so much for the library ! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am using react-hook-form to manage a form in React Native and applying a custom phone mask to an input field. I have a question about the necessity of using setValue along with onChange.
Here is a simplified example of my code:
My Question:
What happens if I use only onChange to update the input value and do not call setValue? Will the final result be the same?
Below is the modified version without setValue:
I would like to better understand the difference and practical implications of using setValue along with onChange versus using only onChange.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions