I'm not getting input focus
I'm trying to implement this hook that is in the official React documentation.
function TextInputWithFocusButton() {
const inputEl = useRef(null);
const onButtonClick = () => {
// `current` points to the mounted text input element
inputEl.current.focus();
};
return (
<>
<input ref={inputEl} type="text" />
<button onClick={onButtonClick}>Focus the input</button>
</>
);
}
Please format your code using

I'm not able to edit your issue, sorry.
Please format your code using
I'm not able to edit your issue, sorry.
Updated.
It's the React Documentation code ... I put the ref on Input inside the Form component
Hello @SereiaMaster, you good?
We've released Unform 2.0 馃帀
Now you can access the input reference by using the getFieldRef function.
Check this guide to upgrade to v2: https://unform.dev/migration-guide
And this guide to understand how to focus the inputs: https://unform.dev/recipes/accessing-field-ref
I'll close the issue for now but feel free to reopen or create new ones if you have any problems.
Most helpful comment
Updated.
It's the React Documentation code ... I put the ref on Input inside the Form component