3 ms·
No, you don't. React does.
by willsmith72 2y ago
No, you don't. React does.
- LegionMammal978 2y agoI think I get what GP means. Without very judicious use of useMemo, you can't move a piece of state into an outer component without causing the rest of its children to also be re-rendered when the state is changed. I recall having to fiddle around with useRef at least a few times due to this, to avoid lots and lots of useMemo churn.
- willsmith72 2y agoBut that's the whole point of react compiler, which is the whole point of the post we're talking under
- yunohn 2y agoHave you tried wrapping component exports with memo? That basically solved everything for me. It’s the equivalent of functional components from before hooks. > export default memo(ExampleComponent)