>i.e. on every state update, the whole app gets rendered
Yes, that's basically correct:
>Calling setState notifies the framework that the internal state of this object has changed in a way that might impact the user interface in this subtree, which causes the framework to schedule a build for this State object.[0]
The `build` method rebuilds the entire widget tree. So "the whole app" does not necessarily get re-rendered, only whatever is in the same widget as the changed state or below it, although potentially that can be the whole screen. Flutter also uses an algorithm to detect unchanged widgets and reuse them,[1] but conceptually the whole thing is re-rendered on state change.
It does work that way. However, Flutter and now React (via their new compiler) are becoming smarter at rerendering, where they will only rerender what has truly changed, not just rerender the entire tree below the changed component.
Yes, that's basically correct:
>Calling setState notifies the framework that the internal state of this object has changed in a way that might impact the user interface in this subtree, which causes the framework to schedule a build for this State object.[0]
The `build` method rebuilds the entire widget tree. So "the whole app" does not necessarily get re-rendered, only whatever is in the same widget as the changed state or below it, although potentially that can be the whole screen. Flutter also uses an algorithm to detect unchanged widgets and reuse them,[1] but conceptually the whole thing is re-rendered on state change.
[0] https://api.flutter.dev/flutter/widgets/State/setState.html
[1] https://docs.flutter.dev/resources/inside-flutter#linear-rec...