DEV Community

Discussion on: React useEffect cleanup: How and when to use it

Collapse
 
andresavellan profile image
Andres Avellan

Thanks, nice article.

What about putting setloading(true) in the return function?
ex.
return function cleanup() {
setloading(true);
}
Would it differ from mounted = false? and why?
Thank you in advance.