News for hackers. Stuff that matters.
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.
Re:Metaphysics and JavaScript by nezygis on Thursday September 05, 2019 @02:36AM (#20884374)
Could you share some examples of hooks used wrongly in code?
Re:Metaphysics and JavaScript by Tade0 on Thursday September 05, 2019 @07:47AM (#20885727)
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.