I need advice on handling refs. #12300
Unanswered
narek-arakelyan99
asked this question in
Q&A
Replies: 0 comments
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.
-
I need advice on handling refs. I have a ref coming from a parent component and a ref callback from a controller component. Both are passed to a TextField via a customRef prop. The problem is that the customRef function reference changes every time the input is typed in or when the parent component’s state changes.
How can I ensure that the customRef function only runs once and doesn't change on every re-render, like a memoized callback?
Or am I approaching this the wrong way? Do you have any other suggestions?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions