Thanks for your quick reply. But what if I load the email and username from the state. How can I disable the touched option on those input fields? Because they don't have to be changed everytime but my button keeps disabled.
I tried some things like checking if the state is set and if its set then: this.props.setFieldTouched('email', true, false); but that doesn't seem to work.
How can I get the values from the form to submit them?
pass a submit function to
formikonSubmitprop.Formik then provides you with a
handleSubmitprop which you use to handle submit in your form.handleSubmitbasically passes all the values in your form to the submit function you passed toonSubmithow can I set the value to the state if it has been fetched from the database.
I didn't use state for my initial values in the article but it's use state.
then in your
componentdidmountyou can do your database call then setstate and then pass the state values toFormikinitialValuesprop.Link to Demo
Thanks for your quick reply. But what if I load the email and username from the state. How can I disable the touched option on those input fields? Because they don't have to be changed everytime but my button keeps disabled.
I tried some things like checking if the state is set and if its set then:
this.props.setFieldTouched('email', true, false);but that doesn't seem to work.Could you please provide me more info about the function to check if the field is touched? So I can try to modify it myself?
Sorry I have be busy recently, Right now I don't think formik has any apis to check if a field is touched.