|
|
|
|
|
by halflife
560 days ago
|
|
In class components you just could await the result and perform a set state, and that would be it. Easy as pie.
But now in function components when everything is called all the time without your control you have to use escape hatches like use effect just to work around react. |
|
Of course, the class component solution to this was to use an HOC, but that had its own issues like complex data flow and wrapper hell.
Hooks solve problems of composition without Yet Another Wrapper and they give clearer data flow, better ref forwarding, etc.
It's easy to see complicated useEffect spam and blame hooks but frankly that wasn't any better when it was happening at different layers of HOCs.