Unform
Accessing field ref
Accessing field ref
To access a single field reference, you can use the getFieldRef
function
exposed inside the form ref.
1export default function MyForm() {2 const formRef = useRef(null)34 function focusNameInput() {5 const nameInput = formRef.current.getFieldRef('name')67 nameInput.focus()8 }910 return (11 <Form ref={formRef}>12 <Input name="name" />13 </Form>14 )15}