4 ms·
The main gotcha with hooks is declaring dependencies for re-renders. It does not take very long long to learn, and it certainly is simple to fix once the proble
by chrisco255 5y ago
The main gotcha with hooks is declaring dependencies for re-renders. It does not take very long long to learn, and it certainly is simple to fix once the problem is realized.
One of the nicest things about hooks + functional components is how much easier it is to refactor. With class based components, nested state and lifecycle behavior made it sometimes difficult to break down complex components.
But I feel like with functional components and hooks, refactoring into logical subcomponents is a breeze.
- linkgoron 5y agoI believe that React's hooks implementation is sub-par, not that "a" hooks implementation wouldn't work. Their current implementation badly needs a real compiler (the whole dependencies array stuff is atrocious, as well as some of the useMemo/useCallback performance issues), or a totally different approach that is actually reactive (e.g. SolidJS). IMO the burden of their implementation on the developer is too large.