Preferences

More likely they don't even need to use useMemo if it's not an expensive calculation. They can just calculate the dependent values during rendering, which is explained in the docs: https://react.dev/learn/you-might-not-need-an-effect#updatin...

If `getLinkedCats` calls an external API, then the calculation can instead be all in the same useEffect.

The number one mistake I see people inexperienced with React doing is using too many useEffect's in their code, which is both hard to read and hurts performance, since it results in more renders than necessary.


I'll point out that just on this comment string from telmac are 3 different interpretations of what is wrong with the code and what should be done instead.

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal