Re:Why Do React Hooks Rely on Call Order?
by drekembemutombo on Thursday December 13, 2018 @07:08AM
(#18671706)
Enjoying your posts, keep them up! Hooks look like a very powerful API for sharing pieces of functionality between components. You've probably heard this one a lot, but what bothers me a bit about hooks (especially useState) is that before, when you saw a component defined as a function, you could assume that it was just a function that renders something based on its props. However, I think it's a fair trade-off for such a powerful API.
[ Parent
| on HN ]
Re:Why Do React Hooks Rely on Call Order?
by WorldMaker on Thursday December 13, 2018 @02:20PM
(#18675136)
Recent versions of React have encouraged truly pure props-only functions to wrap them with React.memo(), which also adds the benefit of giving them the equivalent of a shallow-check `shouldComponentUpdate()` avoiding re-renders when the props are the same.
React.memo() is all the more useful of a signal in the Hooks world.