|
|
|
|
|
by hombre_fatal
564 days ago
|
|
Hooks let you wrap all sorts of logic (and other hooks) and return values that rerender the callsite component when changed. Just keep adding on to my hook example and you get more and more code that you need to repeat in every class component that uses it. 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. |
|