Using useRef for unmounting & unergistering #8626
ShahriarKh
started this conversation in
RFC
Replies: 2 comments 1 reply
-
thanks for sharing the solution. perhaps we can kee this discussion here as a knowledge sharing. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Just a question: doesn't |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In the docs (https://react-hook-form.com/api/useform/unregister), we have:
Another solution is to use
useRef
, especially for cases when the existence of the component is not controlled by itself. For example, an input might be deleted by clicking a button inside another component. For these, I recommend adding this example to docs:If you think it's okay, tell to open a PR in /docs repo.
Beta Was this translation helpful? Give feedback.
All reactions