DEV Community


Discussion on: React Hooks (useContext, useEffect, useState, useRef) Summarized Like Crazy (Short & Concise Article).

hw_tech profile image
Harsh Wardhan

I would suggest to add Case 3 for useEffect() hook mentioning clean-up function (the return function). Use case example: When you need to refresh a particular component let's say every 5 minutes then you would set the interval in useEffect as usual but to clear the interval which should be done in this clean-up return function (similar to componentWillUnmount class component lifecycle method). I'd recommend a short article on this, by Martín Mato -

Overall, nice and concise article. Thanks for this quick read!

ishakmohmed profile image
Mohmed Ishak Author

Thanks bro, I'll add it to my article.