4 ms·
Memoization isn't a free lunch. I think React's approach is to keep it simple with not managing cache stores for absolutely everything. Most small to medium rea
by have_faith 5y ago
Memoization isn't a free lunch. I think React's approach is to keep it simple with not managing cache stores for absolutely everything. Most small to medium react apps need little to no use of useMemo to be performant.
- remram 5y agoIf I remember correctly, React's default approach of comparing states/props is a shallow comparison (e.g. for PureComponent). That seems about as close to free as you can get. I use PureComponent everywhere, but I don't know what people do in function-component world.