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

> Correct, but it is more verbose and ugly to not use JSX

I don't agree with that. I tend to prefer hyperscript to JSX (for personal projects) and I think it looks perfectly fine.

> I guess the argument is you shouldn't be compiling things on the clients browser.

How's that an argument at all?



You are saying this...

    var rootElement =
      React.createElement('div', {}, 
        React.createElement('h1', {}, "Contacts"),
        React.createElement('ul', {},
          React.createElement('li', {},
            React.createElement('h2', {}, "James Nelson"),
            React.createElement('a', {href: 'mailto:[email protected]'}, '[email protected]')
          ),
          React.createElement('li', {},
            React.createElement('h2', {}, "Joe Citizen"),
            React.createElement('a', {href: 'mailto:[email protected]'}, '[email protected]')
          )
        )
      )
...is just as readable as this?

    var rootElement = 
      <Div>
        <H2>Contacts</H2>
        <Ul>
          <Li>
            <H2>James Nelson</H2>
            <A href="mailto:[email protected]">
              [email protected]
            </A>
          </Li>
        </Ul>
      </Di>
The whole point of JSX is to make working with React more like html, because it is easier and more readable.

> How's that an argument at all?

Huh? You mean, the argument that you shouldn't be sending un-compiled content to the client? I don't know why I'd have to argue for this, but render speed is one of the big reasons. Also download size. If you don't recompile, you have to include babel as well, on the client.


Without touching any of the other points, your first example isn't hyperscript.


Oh, I didn't see that. I thought you meant raw React.

But even then, now you want people to learn a new tool to use React "simply"?




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

Search: