5 ms·
Um, a lot of what I see in React.js reminds me of Knockout.js but without the data binding on the view side. I know there's a lot more to it than that, but the
by programminggeek 12y ago
Um, a lot of what I see in React.js reminds me of Knockout.js but without the data binding on the view side. I know there's a lot more to it than that, but the simple example seems like something Knockout's MVVM model could handle in similar or less complexity.
So why use React.js when Knockout.js works perfectly fine?
- dustingetz 12y agoMaybe it's easier to see by example. Knockout doesn't do so well when the state isn't trivial. Build these in Knockout, I dare you to try. (Once upon a time, I tried, and failed, and now I use React) http://wingspan.github.io/wingspan-forms/examples/form-twins/ http://wingspan.github.io/wingspan-forms/examples/form-twins... http://wingspan.github.io/wingspan-forms/examples/faceted-search/ http://wingspan.github.io/wingspan-forms/examples/faceted-se...
- Aqwis 12y agoUh, both seem relatively trivial. I've built considerably more advanced stuff in Knockout.
- candl 12y agoThese seem to be React wrappers around KendoUI. There are wrappers in Knockout for the same library as well. http://kendo-labs.github.io/knockout-kendo/index.html http://kendo-labs.github.io/knockout-kendo/index.html Writing custom bindings in Knockout is quite easy. I also do not understand the appeal of React. Performance is often cited because of the virtual DOM implementation, but for example in this benchmark Knockout is three times faster than React in my browser. http://vuejs.org/perf/todomvc-benchmark/ http://vuejs.org/perf/todomvc-benchmark/ The only criticism that can be made against Knockout is the syntax when using observables in bindings (the ugly and error prone parentheses) and lack of reusable components. The first is solvable by using the Knockout-ES5 plugin if we are willing to drop IE6 to IE8 support. As for the second, components are finally comming to Knockout: https://github.com/knockout/knockout/pull/1396 https://github.com/knockout/knockout/pull/1396
- dustingetz 12y agoFor the record (for anyone who is following the discussion), I have used the KendoUI/Knockout bindings and am comparing Knockout and React on equal ground. Nothing about the programming model would change if you just used straight HTML <input>s. The main issue with Knockout here, is that the state of these apps (the JSON blob that changes as you click around) is not nice and rectangular and doesn't fit nicely into ko.observable and ko.observableArray. particularly the faceted search demo has tension where the lefthand facet checkboxes are grouped and have counts, but the top facet list is not grouped and don't have counts. In react, those are backed by the same state data, and the data is just regular nested javascript objects and arrays, you don't need to access the data through observables. You just use underscore to transform the data as you see fit.