Why does my Form reset/cleared when I use useState [React] #68
-
So, using useState (set) triggers re-render of component. Current data is being reset/cleared every time 'setState' is triggered. How to prevent this? Just a simple show or hide of an element triggers re-render, and my form will be cleared out. |
Beta Was this translation helpful? Give feedback.
Answered by
sergeythrees
Jun 5, 2025
Replies: 1 comment 2 replies
-
Hi, @junixquiaoit |
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
Hi, @junixquiaoit
you forgot to wrap the loadForm function in a useCallback, so a re-render occurs.