Answer the question
In order to leave comments, you need to log in
Unmount component - what is it?
Hello ladies and gentlemen.
A question.
I am making an application using the API, pulling out all the necessary information from there, including images.
Everything works fine, however, sometimes, for some reason, the following happens with pictures. When updating a state (going through sections), sometimes I didn’t understand the pattern of the error, an error occurs that my pictures were not found (although everything was fine before that).
Then the second error appears immediately: 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.
To be honest, I did not quite understand how to fix this error. The only thing that helped was restarting the application.
If possible, explain what it is and how the problem can be solved.
Answer the question
In order to leave comments, you need to log in
In useEffect or in some other way, you placed an event handler on something (element, store, etc.), the component was unmounted, but the handler remained.
UPD:
Actually, I will answer the title of the question. Unmount - the end of the component's life cycle, it was removed from the virtual DOM, to simplify.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question