'Can't perform a React state update on an unmounted component. memory leak in my function

this is the image

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. everytime i navigate to another route this is the waring i get. how to solve this? this a portion of my code



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source