Answer the question
In order to leave comments, you need to log in
How to make an input field active when clicking on another element?
Good afternoon!
I am writing a universal TextField component that can be used on application pages.
Task: when clicking on the pencil icon , it is necessary to make the input field active i.e. focus.
Solution: hang ref on the input field, make ref unique for each field.
But this solution seems clumsy to me, maybe there are more concise methods?
Working example: https://codesandbox.io/s/rrjvjy5qp4
Answer the question
In order to leave comments, you need to log in
Solution: hang ref on input field
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question