How to get access to ref property of form elements (eg IonInput)

Hey,

I’m trying to use React Hook Form https://react-hook-form.com/ and for that I need access to form elements ref property. I’m using typescript and it doesn’t recognize this property on IonInput and other Ion elements. Does anyone have a clue how I can get access to ref? Nothing in documentation. I tried itemRef but that also didn’t work. Can I just use normal Input? will it render properly on Android and IOS?

Just cheat…

      <IonInput
        name="username"
        ref ={register({ required: true }) as any}
      />
      {errors.username && <p>This field is required</p>}

OR

2 Likes

Thanks man, appreciate it. using custom register works.