DEV Community

Discussion on: Stop Thinking In Lifecycle Methods

Collapse
 
dance2die profile image
Sung M. Kim • Edited

Hi Ian,

After using hooks, I just can't go back to Class component life cycle methods, which I had to look up everytime for method definitions, what props/states are passed to each.

useEffect became more natural as I don't have to figure out when it's called and can control when it's called.

To make a comparison, old class component life cycle methods reminds me of old ASP.NET Web forms, which had its life cycle methods, such as page load, page unload, etc and ASP.NET MVC rid that issue.

And async method callback for useEffect will trigger a warning.

Also discussed here

Async useEffect is pretty much unreadable #14326

linvain avatar
linvain commented on Nov 26, 2018

heh

The only alternative is using then() chains which aren't very readable at their own.