|
|
|
|
|
by mehagar
350 days ago
|
|
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. |
|