Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


'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.


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.


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.


>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.


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.


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.


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.


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.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: