@@CodewithSloba actually I'm confused. useEffect and useMemo both take dependency array and are executed when value of dependency array changes so how they are different?
@@hassanshahid567 useMemo executes the function and it caches the result. useCallback caches the instance of function, in case you want to send it as a property to a child. So it doesn't trigger re-render. I hope it's clear now
it’s not the same, useMemo caches the result of the function, but useCallback caches the function without executing. You use useCallback when you want to pass a function as a prop
Great vidéo ! Thanks a lot.
Please what tool do you use for the animated presentation ? It's really nice.
Thanks, adobe
Thanks
You're welcome
Cant we achieve the same thing by useEffect?
I don’t see how you can achieve the same
@@CodewithSloba actually I'm confused. useEffect and useMemo both take dependency array and are executed when value of dependency array changes so how they are different?
@@hassanshahid567 useMemo executes the function and it caches the result. useCallback caches the instance of function, in case you want to send it as a property to a child. So it doesn't trigger re-render.
I hope it's clear now
@@CodewithSloba yes!! Thanks 🙏
isn't it same like usecallback what is the difference between usecallback and usememo??????
it’s not the same, useMemo caches the result of the function, but useCallback caches the function without executing.
You use useCallback when you want to pass a function as a prop
@@CodewithSloba thanks 🙏