How can I attach to a stateless component’s ref in React?
You can useuseRef hook which is available since v16.7.0-alpha. EDIT: You’re encouraged to use Hooks in production as of 16.8.0 release! Hooks enable you to maintain state and handle side effects in functional components. function TextInputWithFocusButton() { const inputEl = useRef(null); const onButtonClick = () => { // `current` points to the mounted text input … Read more