In the docs the following is stated:
useMemo will only recompute the memoized value when one of the dependencies has changed. This optimization helps to avoid expensive calculations on every render.
Sounds nice, isn't it? But to optimize performance one needs to be sure the calculations are more expensive than useMemo itself before using it. Are there any suggestions to when to avoid useMemo?
Use memo only when rendering a component is expensive
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With