|
|
|
|
|
by aidos
2247 days ago
|
|
Hooks allow for declarative behaviour that’s harder to model other ways. With hooks, something like declaring when an event listener should be in play becomes much cleaner. The alternatives with class components are messy. The above criticism that you don’t get to have pure functional components anymore doesn’t really make sense to me - either you have some lingering state to deal with, or you write a pure function. Your hand is forced by the problem. You could switch over to class components but they’re really not much clearer to read. Most of the bugs I’ve seen have been around JavaScript’s crummy equality checks and the need for more memoisation. |
|