Question:
i try to get Items data. if request response less than 1 i have to request again. so i write a recursive function with setTimeout. but when i try to change my route function keeps working. window.clearTimeout() or global.clearTimeOut() not worked here when component unmounts. Do i miss something?Answer:
Use a ref to store thetimeout ID
and then clear that timeout.If you have better answer, please add a comment about this, thank you!