Nice article! I just want to point you should avoid unnecessary optimizations. Before using React.memo, useCallback or useMemo is good to measure if it actually cause a performance boost or don't.
"Performance optimizations ALWAYS come with a cost but do NOT always come with a benefit. " kentcdodds.com/blog/usememo-and-us...
You can also avoid including pressCount on the deps array by using a function on setPressCount like this:
setPressCount(current => current + 1);
Hey Javier, thanks for the comment 😊 .
I Completely agree with you, "Optimisation always comes with cost". My examples looks very simpler, but the situation i want through (you can see comparison of app working in video i shown), that pushed me to optimising stuffs. We need to choose between Optimisation cost vs Cost of unoptimised app before using them.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Nice article! I just want to point you should avoid unnecessary optimizations. Before using React.memo, useCallback or useMemo is good to measure if it actually cause a performance boost or don't.
"Performance optimizations ALWAYS come with a cost but do NOT always come with a benefit. "
kentcdodds.com/blog/usememo-and-us...
You can also avoid including
pressCount
on the deps array by using a function onsetPressCount
like this:setPressCount(current => current + 1);
Hey Javier, thanks for the comment 😊 .
I Completely agree with you, "Optimisation always comes with cost". My examples looks very simpler, but the situation i want through (you can see comparison of app working in video i shown), that pushed me to optimising stuffs. We need to choose between Optimisation cost vs Cost of unoptimised app before using them.