Re:React vs. Ember – EmberNYC slides
by rakoo on Tuesday September 02, 2014 @01:30PM
(#8258923)
Don't use it. JSX is a syntactic sugar for you to manipulate HTML-like stuff, but it's all javascript in the end. It's completely optional.
[ Parent
| on HN ]
JSX is optional, but I've come to really enjoy it.
Here's why:
1. Right next to the logic of how a component is meant to function is the markup it will ultimately render with (or something pretty close to it).
2. I still avoid, for the most part, "magic attributes" like in Ember and especially Angular.
It's not perfect, but it is optional. If you're fine transforming CoffeeScript (a bad example - I can't stand CoffeeScript:) then find an inner peace seeing some XML in your JS documents.
On the subject of CoffeeScript and React/JSX, our team uses something like this[1] to reduce the need for `React.DOM[...]` or lots of `requires` to components.
Our components end up looking like this. As a CoffeeScript/Jade fan, I obviously like it:
ReactElementBuilder = require './lib/react-element-builder'
# Example: add react-bootstrap components.
ReactElementBuilder.addMany require('react-bootstrap')
MyComponent = React.createClass
mixins: [ReactElementBuilder.mixin]
render: ->
@e 'div#main', null,
@e 'Navbar.fixed',
onClick: @handleNavbarClick
'Hello my name is Navbar'
[1]: https://gist.github.com/mikew/e737273e42ed704c6c54