DimensionDev / Maskbook-Talks

Where talks of Maskbook happen.
7 stars 1 forks source link

[Talk] When to useMemo and useCallback? #52

Open zhouhanseng opened 4 years ago

zhouhanseng commented 4 years ago

https://kentcdodds.com/blog/usememo-and-usecallback

Jack-Works commented 4 years ago

We use useMemo and useCallback when it might be re-render multiple times or it's a widely used hooks. In the other cases, use those hooks is okay but will make the code harder to read.

Do you find out we are using the react hooks in the wrong way? please point out, thanks!

zhouhanseng commented 4 years ago

Hi! Jack-Works, I recommend you to read this blog while you are leisure. As I trust the writer, there're only two specific reasons why we should use these hooks:

Jack-Works commented 4 years ago

Yes I have read that article and totally agree with it but I don't have budget to review those usages, maybe I'll do that later, thanks.

I'll leave this issue open until I reviewed the code