| I see two problems with the basic idea of JSX: - Parsing is a mess, it is not even obviously unambiguous. - HTML syntax is horrible, and all templating language attempts building on it are verbose and clumsy. That is the negative argument (“That is crap”), but there is also a positive argument (“Here is a much better alternative”): You can express HTML structure in a concise and relatively readable manner in plain JavaScript, and you do not need a 400 kb interpreter nor a separate compilation step for it! ['div', {'class': 'foo'},
'some text',
['span', {}, 'yay']]
You also can embed "directives" or "components" in a rather obvious and unambiguous way: ['div', {'class': 'container'},
[MyConstructor, {'arg': foo()}]]
Implementing a robust interpreter for this is a matter of perhaps 50 to 100 lines of plain JavaScript. |