4 ms·
React went from class components to function components and from lifetime callbacks to hooks. These concepts are completely orthogonal. There exist design choi
by sfvisser 3y ago
React went from class components to function components and from lifetime callbacks to hooks. These concepts are completely orthogonal.
There exist design choices that would end up with a different combo. Class components with hooks or function components using lifetime callbacks.
Yes, hooks — basically sub components with possible effects and yielding values, or DOM output — are a terrific idea and much more functional and principled than explicit lifetime callbacks.
All the dependency arrays and non-conditional checks etc are because of the function components approach and don’t have much to do with hooks.
I feel nearly every discussion on hooks mixes this up and makes the whole conversation just weird and confusing.
- troupo 3y ago> All the dependency arrays and non-conditional checks etc are because of the function components approach And because of React's design choices. Reactivity can be achieved without explicit dependency lists.