React 18 – destroy is not a function

My application was working fine, then I updated it to react 18, now it is throwing “destroy is not a function” when I navigate from one route to another if the current route is using useEffect to call some APIs on load. I searched the internet in this regard but every question is not regarding this issue. maybe react 18 is new thats why i cant find a solution..