8 ms·
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.
by rakoo 12y ago
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.
- mrcwinn 12y agoJSX 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.
- mikewhy 12y agoOn 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 https://gist.github.com/mikew/e737273e42ed704c6c54