2 ms·
> The goal behind "hooks" was to make React simpler for beginners No, it had nothing to do with making it "simpler for beginners." It was to functionalize stat
by satvikpendem 3y ago
> The goal behind "hooks" was to make React simpler for beginners
No, it had nothing to do with making it "simpler for beginners." It was to functionalize state changes in a way that was impossible with classes and other OOP constructs like mixins. There is actually a great issue thread on the Flutter GitHub that explains exactly why other solutions do not work correctly when compared to hooks [0]. What people don't get about hooks is that they are an abstraction over state and app lifecycle changes. It is better to think of them as akin to closures but over lifecycles, not just holding state as closures do.
[0] https://github.com/flutter/flutter/issues/51752 https://github.com/flutter/flutter/issues/51752
- codethief 3y ago> There is actually a great issue thread on the Flutter GitHub that explains exactly why other solutions do not work correctly when compared to hooks [0] Interesting. I assume you are referring to this comment in particular -> https://github.com/flutter/flutter/issues/51752#issuecomment-665380355 https://github.com/flutter/flutter/issues/51752#issuecomment... ?
- satvikpendem 3y agoThe whole thread is worth a read, the first post in particular lays out why traditional class-based solutions don't work, while that comment by Dan Abramov is good in its own way, viewing hooks through the lens of algebraic effect handlers.
- throwaway220033 3y ago> No, it had nothing to do with making it "simpler for beginners." Open up the announcement of hooks by Dan Abramov and listen him.