I understand. There is a great explanation on why you should use it in a previous post I wrote, using websockets with React.js. I explained in detail how use Callback saved my life there.
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:
Referential equality
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
I understand. There is a great explanation on why you should use it in a previous post I wrote, using websockets with React.js. I explained in detail how use Callback saved my life there.
I will check it out! Cheers!
@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:
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
Fantastic I'll check that out too, thanks for the info
Yup, totally agree here, that was in part why I wanted to understand it better
Already Archived and prepating a better one