5 ms·
Not sure what you mean "rerun all the tree", if you change a a state variable that is added as a prop in another component it has to rerun refresh on those comp
by digitalarborist 10y ago
Not sure what you mean "rerun all the tree", if you change a a state variable that is added as a prop in another component it has to rerun refresh on those components, but only those components, so not all the tree. Also not sure how this relates to atomic updates, with a flux pattern each state change is associated with ui changes propogating down, the difference to angular is, they aren't supposed to be allowed to propogate up, which you can do in angular since there isn't necessarily a central state store and since there is two way binding children or parent can change the variable.
It's easy enough to write two way binding into a react state variable, it's just nice to not have it happen by default since having state able to change anywhere in the app can get confusing.
- saskurambo 10y agoYes but generally speak you must do all this things manually and also optimizatio s and binding you must know what updates. In a real 2way db this is automatic also for performance.
- qwertyuiop924 10y agoNo, the perf's pretty bad if you do a lot of binding, and the manual binding gives you a better sense of what your app is doing, the performance tradeoffs you're making, and more control over an area where you'll probably have to optimize.
- saskurambo 10y agoVue.js 2 is an hibrid between virtual dom and data binding.
- qwertyuiop924 10y agoAll VDOM systems are. The difference is how explicit the data binding is: I maintain implicit 2-way binds, Angluar style, are a Bad Idea.
- saskurambo 10y agoMmm no sorry i don't agree. For me virtual dom is only a tree generated from code,diffed and batched. Speaking only of the algoritm. For me databining templates libraries are vue and ractive. See this 2 links for comparison. https://vuejs.org/guide/comparison.html https://vuejs.org/guide/comparison.html http://blog.ractivejs.org/posts/whats-the-difference-between-react-and-ractive/ http://blog.ractivejs.org/posts/whats-the-difference-between...
- qwertyuiop924 10y agoThat's true, but what I meant was that all VDOM based systems have binding to some degree, and where optimization is required, explicit is better than implicit.
- saskurambo 10y agoA virtual dom is stupid about the view is only an algorithm that diff 2 trees. A data binding can create a graph of knowledge about the view and can create the best and fast mode for update the view. Library like ractive and vue are the best tools for create animations in svg or where there are many updates of view
- qwertyuiop924 10y ago...Which is why Mithril and React provide escape valves, for situations in which the VDOM abstraction is ill suited.