Hacker News new | ask | show | jobs
by efdee 4055 days ago
I get the feeling that you're just arguing for the sake of arguing. You can't in one comment say that it's hard to move things around and then in the other comment say that of course it's not hard to move things around.
1 comments

Maybe if you will read my comments more closely you will see the difference between moving parts of HTML inside component and moving components. "Moving things around" is too broad term.
The distinction you're making between "HTML" and "facility for encapsulating generated HTML" seems pretty arbitrary.

I was making a simpler point, though.

Some of the reactions I see to React seem to come from the notion that it's mixing application logic with view logic. That's an easy misconception to get from reading the tutorials and quick-start documentation: after all, it's using raw Javascript to generate HTML, which is the same language other frameworks use for application logic.

The misconception comes I think from comparing React to Angular. Angular is an application framework. React is solely a view framework. It happens that React uses Javascript --- which works amazingly well in practice! --- to express views. But that doesn't mean it's mixing application logic and view logic.

That's all I was saying. The semantic argument between "components" and "HTML" is totally uninteresting to me. The important point, regarding ease of moving "bits of UI" around, is that React makes it astonishingly easy to do that. It's one of the selling points of React.

In my first response to you I underlined I don't mean business logic.

It's the example from "JSX in Depth" (https://facebook.github.io/react/docs/jsx-in-depth.html)

  // Input (JSX):
  var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>;
  // Output (JS):
  var content = React.createElement(
    Container,
    null,
    window.isLoggedIn ? React.createElement(Nav) : React.createElement(Login) );
And it illustrates exactly what I'm trying to say: composing page from JS with conditional logic. It's plague, because it will be painful to edit.
I find it vastly, comically easier to edit React/JSX than templated Angular and Knockout.