DEV Community

Discussion on: You MUST use the useCallback hook!

 
exneval profile image
Egi Ginting • Edited

@nombrekeff

Check Kent C. Dodds article if you still not get it, (I'll just copy some part of it here below)

Q: So when should I useMemo and useCallback?
A: There are specific reasons both of these hooks are built-into React:

  1. Referential equality
  2. Computationally expensive calculations

And thanks for the article @itays123 , hope it can cover more complex cases and explanation in the future so some readers won't get the wrong idea of this hook, because premature code optimization can lead them to make thing worse

Thread Thread
 
nombrekeff profile image
Keff

Fantastic I'll check that out too, thanks for the info

Thread Thread
 
nombrekeff profile image
Keff

because premature code optimization can lead them to make thing worse

Yup, totally agree here, that was in part why I wanted to understand it better

Thread Thread
 
itays123 profile image
Itay Schechner

Already Archived and prepating a better one