4 ms·
> Declaratively describe your UI, React paints it. That's it. No app state management. "that's it" does not paint the full picture. Yes, UI = function(state) i
by smarkov 2y ago
> Declaratively describe your UI, React paints it. That's it. No app state management.
"that's it" does not paint the full picture. Yes, UI = function(state) is very convenient but the way React implements it inverts the problem. Now instead of having to figure out ways of updating everything you have to go through numerous hoops to get only the things you need to update.
- willsmith72 2y agoNo, 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)
- bastawhiz 2y ago> Now instead of having to figure out ways of updating everything you have to go through numerous hoops to get only the things you need to update. That's literally the point of React Compiler