I have a form with several fields that can be with different order, and each field has different purpose.
For exmaple, sometimes the form can hold:
email
name
phone
and later it changes to:
phone
email
address
other_field1
These fields need to do validation as per their "type". For example, I need to get ref[email].current.value
, in order to check it is a proper email.
How can I use the useRef
for this form?
update
I found a solution based on this: https://stackoverflow.com/a/54661320/4360433