CodeSandbox:
Question:
Click on reset button and clear a field with value "initial value"
Attempts:
There are too many variants to reset form via:
resetForm()setFieldValue(<your_field_name>, '')form.current.reset()
But this list doesn't helpful when you have initial value in formik field.
Snippet:
import React from 'react'
import {Formik, Form, Field} from 'formik'
const Search = () => (
<Formik onSubmit={({q}, {setSubmitting}) => {
setSubmitting(false)
}} initialValues={{q: 'initial value'}} render={({resetForm}) => (
<Form>
<Field name='q' />
<button type="reset" onClick={() => resetForm()}>Reset</button> {/* <== Reset */}
</Form>
)}/>
)