DEV Community

Discussion on: Are you using React ? Then I think you must know this

Collapse
 
jackmellis profile image
Jack

Definitely some misleading things in this piece:
There's a difference between memo and useMemo, they are totally different (although they do complement each other), you should also be careful not to just memo everything as this can often be more expensive than just recalculating. There are plenty of articles and metrics on this topic.
Calling setState async is misleading. Yes it batches your state updates until the end of the render cycle, but it's not async in the classic sense. Async is associated with promises and delayed callbacks.
Don't take this as criticism of your writing, sharing and creating content is great, I just want to clear up some (pretty common) misconceptions

Collapse
 
sudarshansb143 profile image
sudarshan

Thank you jack for your explanation it is pretty good ! πŸ™

Although my point of mentioning the memoization is closely related to how we can 'cache' the dumb components and avoid them from re-rendering. Although, after reading your point, I will definitely take deeper look into this.

I am calling setState() as async in the sense of it's execution, as compared to other sync code like classical for -- of loop.

Although, I want to thank to you for this. I will take it as a helpful note and I will definitely improve myself in my next one😎

Make sure you criticize that also πŸ˜…πŸ˜