Re:Metaphysics and JavaScript
by Tade0 on Wednesday September 04, 2019 @04:52PM
(#20881296)
To add insult to injury it's fairly easy to use hooks wrong - and used wrong they are, which suggests that their learning curve is not as friendly as proponents of this pattern would wish.
[ Parent
| on HN ]
Could you share some examples of hooks used wrongly in code?
useCallback used as something else than a provider of callback functions, e.g. for rendering.
Example:
const renderItem = useCallback(() => <Item />, []);
And then: return renderItem();
What should have been used here is useMemo.