top | item 40821773

(no title)

smarkov | 1 year 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.

discuss

order

bastawhiz|1 year 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

willsmith72|1 year ago

No, you don't. React does.

LegionMammal978|1 year ago

I 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.