I use the withFormik HOC and make use of the status variable to display a message for failed logins.
I use setStatus('Invalid credentilas') in handleSubmit and it is working fine. However I need to reset/empty the status when the user has changed/touched the username or password-field after the attempted submit.
From what I can gather, I can not use the handleChange to reset the status as handleChange is not availible in withFormik()?
using Formik 0.11
withFormik injects all these props https://github.com/jaredpalmer/formik#formik-props to your component.
Hm ok, not sure I understand. How/where exactly can I reset the status onChange when using withFormik?
withFormik provides you handleChange and setStatus handlers. So somewhere in a tree you would do:
<input name="hello" onChange={e => {
setStatus('')
handleChange(e)
}}
/>
Ah, I understand now. Thanks!
Most helpful comment
withFormikprovides youhandleChangeandsetStatushandlers. So somewhere in a tree you would do: