Armen Babakanian
Armen Babakanian

Reputation: 2345

Formik calls onBlur for input on page refresh

I have created a custom form handler for formik, which sets touched to true on page refresh for each input field. I placed a console.log on onBlur for each input field, and on page refresh the onBlur is called.

This causes the touched variable to be set to true for all the field.

Here is the sandbox

https://codesandbox.io/s/priceless-bird-e82wi

Upvotes: 1

Views: 783

Answers (1)

Raj Purohit
Raj Purohit

Reputation: 241

Remove autoFocus="true" from your input field and it's work fine. Below is working codesandbox URL:

https://codesandbox.io/s/clever-jackson-odcjt

Upvotes: 1

Related Questions