DEV Community

Discussion on: React Native Performance Optimisation With Hooks

Collapse
 
neiker profile image
Javier Alvarez

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);

Collapse
 
ltsharma profile image
Lakshmeesha

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.