5 ms·
Can this play nicely with Angular and still make use of Angular's two-way binding?
by dmak 12y ago
Can this play nicely with Angular and still make use of Angular's two-way binding?
- rezistik 12y agoI'm interested in this as well. I believe some people have had success by attaching components to the window as globals.
- josebalius 12y agoTake a look at http://josebalius.github.io/ngReactGrid/ http://josebalius.github.io/ngReactGrid/ for an example.
- auvrw 12y agoif all you're after is two-way data binding and don't necessarily need all the other functionality provided by Angular, it might be worth mentioning that React actually can do that, even though it's not a pattern that occurs that often if you use the Flux application architecture http://facebook.github.io/react/docs/two-way-binding-helpers.html http://facebook.github.io/react/docs/two-way-binding-helpers...
- Spendar89 12y agoI think its important to note that React does not encourage two way data binding. Quite the opposite, actually. Data is supposed to flow one-way, from parent to child. That being said, there's an extension that adds two way bindings, called ReactLink. You can read more about it here: http://facebook.github.io/react/docs/two-way-binding-helpers.html http://facebook.github.io/react/docs/two-way-binding-helpers...
- _greim_ 12y agoI'm not an expert but I think you wouldn't really want to do this as they both want sole control of the chunk of DOM in question.
- rdtsc 12y agoLook at some of Peter Hunt videos: https://facebook.github.io/react/docs/videos.html https://facebook.github.io/react/docs/videos.html 2-way binding is not necessarily the way to go with this.
- kalkeo 12y agogood~
- deepakprakash 12y agoYes, and apparently you can take advantage of React's faster/smarter rendering (http://www.williambrownstreet.net/blog/2014/04/faster-angularjs-rendering-angularjs-and-reactjs/ http://www.williambrownstreet.net/blog/2014/04/faster-angula...) That said, I would be uncomfortable mixing something as opinionated as Angular with another framework that expects to "own" the DOM/rendering. My guess is that Angular will implement their own version of VDOM in the next few months since it shows demonstrably better performance.
- Cthulhu_ 12y agoPretty much this. AngularJS abstracts DOM manipulation away from the user; by adding React to an AngularJS project, you're giving up on that abstraction. I consider React a sacrifice of abstraction / ease of development in favor of performance. I think AngularJS will adopt a similar strategy for their 2.0 development effort, maybe even a 1.x point release. But I haven't looked at the angular development process for a while now.
- peterhunt 12y agoI disagree with this. React abstracts away DOM manipulation just as well as Angular does at a high level. When you dive deeper (i.e. building components/directives) React continues to abstract it away, whereas Angular reveals it. In fact, React is able to get superior performance because the DOM is abstracted so far away.