Memoizing every react component is bad
October 06, 2021
I suddenly had a thought, why not to make a build time plugin to add memo to every single component. Obviously , this is not something only i though of. I saw a good discussion in a issue of facebook/react github repo.And with tweet, i understood memo() everywhere is bad.
Shallow comparisons aren’t free. They’re O(prop count). And they only buy something if it bails out. All comparisons where we end up re-rendering are wasted.
— Dan (@dan_abramov) February 13, 2019
Why would you expect always comparing to be faster? Considering many components always get different props.