Clear Formik field with initial value React
You're totally right - if you have some initial form state, the resetForm
action will set the values to those initials. setFieldValue
probably the only way to manually clear the field:
<button type="button" onClick={() => setFieldValue('q', '')}>
Drop field
</button>
notice, type='reset'
not need here...
In case when you need to drop multiple fields, take a look at this method:
setValues({q: ''})