Re:Common mistakes writing React components with hooks
by Octoth0rpe on Tuesday July 21, 2020 @10:34AM
(#23907079)
I believe the useRef hook is used for this problem:
https://reactjs.org/docs/hooks-reference.html#useref
The example even uses .focus()
Re:Common mistakes writing React components with hooks
by cnity on Tuesday July 21, 2020 @10:42AM
(#23907143)
That's just not true: https://reactjs.org/docs/forwarding-refs.html
For simple components hooks may be fine. For more complex ones I prefer classes.