by a-guest · 9y ago · 0 comments
"JSX is a preprocessor step that adds XML syntax to JavaScript." http://buildwithreact.com/tutorial/jsx
Whereas the templates in Glimmer are built on HTML. At the 10,000 ft view, my two cents: it looks easier to reason about what is going on with dynamic elements in the template via handlebars together with what is going with the html elements themselves in terms of rendering/appearance/css, as compared to the JSX syntax.
i just can't convince myself "it looks less scary" is worthy of the technical tradeoffs (for me, at the very least).
I should have been clearer and said: it actually is easier to reason about the html and the dynamic rendering with the approach Glimmer takes.
Do this in a template for instance:
import range from 'lodash/range'
const Item = ({ number }) => <li>{number}</li>
const App = () => (
<ul>
{range(0, 20, 5)
.map(index =>
<Item number={index} />
)
}
</ul>
)
Templates can't even resolve <Item> because they don't know scope. The have no access to `range` either. Instead we're now hacking around with template registrations and injections. This results in a mess of functionality sprinkled all over the place for no good reason.