DEV Community

Discussion on: Why we don't and should not use React.memo with every compoent to boost performance ?

Collapse
 
jackmellis profile image
Jack

We did this, to literally every component in our app. Hundreds if not thousands of them. We thought it was a great idea, and it never particularly bit us hard or anything. But looking back, it was mostly unnecessary.
Rendering a component is pretty cheap, so you have to weigh up the cost of rendering a component several times, vs the cost of comparing all of that component's props several times. Unless a component is pretty large and complex, the prop check will often just add extra overhead you didn't need to bother with.
In general: keep it simple, then add optimizations when you actually hit performance problems.