News for hackers. Stuff that matters.
Re:React's Diff Algorithm by pornel on Sunday December 29, 2013 @05:44PM (#6981827)
React's rendering looks really awesome, but I'm missing the bit that binds application data to views.

e.g. in KnockoutJS I can just use observable arrays and properties and never have to call `setState()` on anything. What's the equivalent for React?

Re:React's Diff Algorithm by peterhunt on Sunday December 29, 2013 @05:58PM (#6981888)
You can very easily do this by combining Object.observe() (or a polyfill) and calling forceUpdate().

However we've found that this sort of data binding is suboptimal since it encourages mutation which forces you out of some great perf optimizations (like the Om stuff, and Object.observe() has its own performance penalties). And thinking about your data flow a little more explicitly makes it easy to follow where updates are being triggered from (so a mutation in one part of your app doesn't accidentally trigger updates all over the place).

Most of the time doing this explicitly is a little more typing up front but is worth it for larger apps from a performance and maintenance perspective. If you start building with React you'll find that your data model flattens out as you go down the view hierarchy so this becomes less of an issue.

Re:React's Diff Algorithm by juliangamble on Monday December 30, 2013 @01:35AM (#6983382)
You can read more about how React combined with immutable data structures provides great performance in this blog post by David Nolen http://swannodette.github.io/2013/12/17/the-future-of-javasc...
Re:React's Diff Algorithm by vjeux on Sunday December 29, 2013 @06:28PM (#6982028)
If your model is managed by a lib that provides callbacks when a piece of your model is updated you can make a mixin like it has been done for Meteor and Backbone integrations:

https://github.com/benjamn/meteor-react#how-it-works http://eldar.djafarov.com/2013/11/reactjs-mixing-with-backbo...

Re:React's Diff Algorithm by Touche on Sunday December 29, 2013 @05:49PM (#6981852)
setState is equivalent to an observable. The only problem is that it's specific to the component you're working in, you have to get that information to others manually.