You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does anyone use useFormik hook? I need to validate username and password on the server. For validation I use the handleLogin(username, password) method. Here is my code:
The fact is that if the validation is successful, it redirects me to the main page. This causes a memory leak error. Here is the text of the error:
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.
at Formik (http://localhost:3000/static/js/bundle.js:110048:19)
at C (http://localhost:3000/static/js/bundle.js:110430:34)
at Login (http://localhost:3000/static/js/bundle.js:13909:71)
at div
Error at the place where then(() => { setSubmitting(false); }); is called. If you remove it and leave it like that, then everything works fine. But after all, the documentation says that you need to specify setSubmittingin the false state.
As far as I understand, the error occurs when it is impossible to assign a value. the component will be removed when you navigate to another page. How can this be fixed?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Does anyone use useFormik hook? I need to validate username and password on the server. For validation I use the handleLogin(username, password) method. Here is my code:
The fact is that if the validation is successful, it redirects me to the main page. This causes a memory leak error. Here is the text of the error:
Error at the place where then(() => { setSubmitting(false); }); is called. If you remove it and leave it like that, then everything works fine. But after all, the documentation says that you need to specify setSubmittingin the false state.
As far as I understand, the error occurs when it is impossible to assign a value. the component will be removed when you navigate to another page. How can this be fixed?
Beta Was this translation helpful? Give feedback.
All reactions