4 ms·
I really wanted to like Angular but their Vdom is inherently flawed, here's why: In Vue when a component has changes (e.g the user click or input something in
by The_rationalist 6y ago
I really wanted to like Angular but their Vdom is inherently flawed, here's why:
In Vue when a component has changes (e.g the user click or input something in the component), the reactivity autodetection mechanism will trigger changes on the component and its children/descendants.
Angular instead by using zone.js will trigger all the things that Vue rightfully trigger but they will trigger all of the component ancestors too! Up to the root!
This means two things:
You can't debug this mess as any method in the template or onchanges hook in the ancestors will be triggered and console.log() so the Devtools are flooded with unrelated changes.
If you call a store on the template the store debugger will be flooded too.
And all those calls affect performance dramatically which is pure unwanted nonsense.
This non Scoped reactivity might have usefulness for 0.1% of cases (or for 0%?) but even at best, it should be totally opt-in.
But the situation is worse, you cannot opt out.
Or you can, with changedetection.onpush which disable any reactivity (you must manually trigger it in 2020, can you imagine?)
This nonsense made us stay on Vue and everybody in it's right mind should avoid Angular until this fundamental issue is fixed.
https://medium.com/@vyaron/point-of-vue-part-2-facing-angular-e4e9ee65161d https://medium.com/@vyaron/point-of-vue-part-2-facing-angula...
Unrelated: the second huge limitation of angular is that it has no official devtool integration and that the community devtool is mostly unmaintained and doesn't work on angular > 9
- sod 6y agoMy recommendation: Remove zone.js, run angular in NoZone mode and use ngrx. Thats how we do it. Gets rid of all the headaches zone.js introduces, is way more predictable, build is smaller and just updates the components where data changes. And you can see your state in the redux devtools.
- The_rationalist 6y ago1) handling local component state in a store seems terrible. And the Redux devtool will be flooded with commands that are from local and global state access making both indistinguishable and therefore undebuggable. 2) ngrx seems like overengineering^10 and you have more flexibility and much less cognitive load by using Mobx with Angular.
- The_rationalist 6y agoUp, I'd like to know your thought on ngrx vs mobx. For me there was no going back