Formik: Reset dirty property after submit

Created on 16 Dec 2019  路  2Comments  路  Source: formium/formik

Hello

I'm trying to reset the dirty property after my form is submitted.
I'm using it to know if users made changes in the form and alert them when they want to leave the page.

First question : is it the good property tu use for that ?
If yes, how could I reset the boolean to false, once the form is submitted ?

Formik Duplicate Question

Most helpful comment

Something like resetForm({ values: currentValues }) (where currentValues is the values that are now not "dirty") should work, that will set the initial values and compute the dirty property to false

All 2 comments

Something like resetForm({ values: currentValues }) (where currentValues is the values that are now not "dirty") should work, that will set the initial values and compute the dirty property to false

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dfee picture dfee  路  3Comments

green-pickle picture green-pickle  路  3Comments

jaredpalmer picture jaredpalmer  路  3Comments

giulioambrogi picture giulioambrogi  路  3Comments

Jungwoo-An picture Jungwoo-An  路  3Comments