3 ms·
Correct, but it is more verbose and ugly to not use JSX. I guess the argument is you shouldn't be compiling things on the clients browser.
by pknopf 9y ago
Correct, but it is more verbose and ugly to not use JSX. I guess the argument is you shouldn't be compiling things on the clients browser.
- masklinn 9y ago> 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?
- pknopf 9y agoYou 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:james@jamesknelson.com'}, 'james@jamesknelson.com') ), React.createElement('li', {}, React.createElement('h2', {}, "Joe Citizen"), React.createElement('a', {href: 'mailto:joe@example.com'}, 'joe@example.com') ) ) ) ...is just as readable as this? var rootElement = <Div> <H2>Contacts</H2> <Ul> <Li> <H2>James Nelson</H2> <A href="mailto:james@james.com"> james@james.com </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.