Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

At a basic level Flutter renders the entire widget tree and caches components that don't need to re-render rather than applying a diff of changes to the DOM.

But it's really the Flutter/Dart API and widgets that make it much easier to work with, if I need to load some data asynchronously I use a `FutureBuilder`, if I need a stream of events I can use `StreamBuilder` etc. Compared to Reacts state, hooks, memo, effects etc. you end up with code that is far easier to reason about what is rendering when and why.

Oh and the real killer feature is Flutters hot reload experience, it's easily the best DX I've seen for GUI work.

As another comment mentioned it really is like night and day. I recommend giving it a try.



I don't quite understand the point about rendering, unless you mean it in the Angular sense (i.e. on every state update, the whole app gets rendered, and elements are updated to the new state during that render).

But I can imagine that the API can be easier. I think React handles state fairly well, but as soon as that state needs to interact with things outside the React world (http requests, continuously updating data, etc) then the current abstractions don't quite feel right.


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

[0] https://api.flutter.dev/flutter/widgets/State/setState.html

[1] https://docs.flutter.dev/resources/inside-flutter#linear-rec...


React doesn't work in the same way? I don't know much about it, but I assumed it does.


I'm not sure. Hopefully someone here can let us know. I didn't mean to imply that react doesn't work that way.


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.


react and flutter are pretty much the same thing, i do both for a living i am not sure what this person is going on about




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: