News for hackers. Stuff that matters.
Re:Angular 2.0 by iSnow on Tuesday March 18, 2014 @04:49AM (#7420832)
I only looked superficially at React, so maybe I got something wrong, but the HTML/XML intermingled with Javascript seems extremely off-putting to me, akin to ASP/JSP/PHP.
Re:Angular 2.0 by jesstaa on Tuesday March 18, 2014 @06:03AM (#7421043)
'JSX' is also what made me avoid React at first. But once I started using it, it made perfect sense. The 'JSX' is just compiled to Javascript anyway, it's just more convenient for deep nesting of html elements within a component.

In more recent talks the React devs have avoided using JSX in examples and instead use the compiled form as JSX goes far enough from what people expect that it turns people away before they've given it a chance.

The most important idea to take from React is that UI components are much simpler when they are state machines.

Re:Angular 2.0 by donw on Tuesday March 18, 2014 @07:44AM (#7421337)
The thing that sold me on React was this statement: "Most people make the mistake that the DOM is a place you put things."

The DOM is what the user sees. That's all. With React, you have a virtual DOM that can hold everything, not just what the user sees. It's a pure data structure, and can be manipulated as such.

Because that DOM is a pure data structure, React can figure out for you what parts have changed, and re-render those bits as needed.

Re:Angular 2.0 by Touche on Tuesday March 18, 2014 @09:55AM (#7421887)
I agree with you that React's virtual DOM is a real breakthrough. However, that doesn't make all of React worthwhile. Other frameworks can (and should) integrate a virtual DOM.
Re:Angular 2.0 by iSnow on Wednesday March 19, 2014 @04:54AM (#7427404)
>Most people make the mistake that the DOM is a place you put things.

I guess this is why Angular keeps the model separate from the DOM.

That said, the virtual DOM strikes me as a really good idea I'd like to see in Angular.

Re:Angular 2.0 by danabramov on Tuesday March 18, 2014 @04:50AM (#7420836)
It's just the first impression. React view code is not HTML in pure sense—it's a DSL for describing virtual DOM tree (that happens to look a lot like HTML for obvious reasons).

You won't regret taking a couple of hours to try to build something simple with it.

Re:Angular 2.0 by iSnow on Tuesday March 18, 2014 @04:54AM (#7420847)
But then again, is the comparison between Angular and React even a valid one? After all, Angular is more or less MVC with a lot of functionality for resource routing, component building whereas React seems like a view templating library. So if I am not wrong, we are comparing a framework with a targeted library.

The weakness with Angular is not the view imo, but the $apply-cycle which can bog down even a modern browser with moderately sized data.

Re:Angular 2.0 by dangoor on Tuesday March 18, 2014 @07:27AM (#7421279)
React basically eliminates the need for something like the apply cycle, because you just re-render from the top whenever something changes. React is the view layer, but its approach is different enough that you may restructure (and simplify) the rest of your app as a result.
Re:Angular 2.0 by fiatjaf on Tuesday March 18, 2014 @10:59AM (#7422307)
That puts me off too, it's too PHP, as you said, but I love React because I use it with Coffeescript, which eliminates the need for a JSX compilator: http://blog.vjeux.com/2013/javascript/react-coffeescript.htm...

(You can do the same thing with pure JS, there are some forms of simplifying the React.DOM.div() calls, but coffeescript makes it beautiful.)