If you like this blog, you can visit my personal blog sehgaltech for more content.
Welcome back, React warriors! Today we explore fascinating wo...
For further actions, you may consider blocking this person and/or reporting abuse
If you're going to use React hooks, it's best to completely forget about lifecycle methods. The useEffect hook is used to handle side effects, like triggering fetch requests, or handling event listeners that are not part of the React scope. The cleanup function that is returned from the useEffect hook is used to cleanup that side effect.
Btw, class components and therefore lifecycle methods are deprecated and should not be used anymore, which is a good thing, because forgetting about lifecycle methods frees up your mind to learn about programming concepts that are not specific to React.