Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Comparing view source to a string template is easy. So is JSX to the DOM.

The trick is that JSX looks like a string template. Compared to building a tree of nodes (or using the DOM API), XML transforms, or other "more proper" ways to generate HTML, it's more intuitive.

Of course, there are issues with string interpolation, like XSS.



pretty sure JSX can be work into the ES standard. As E4X was part of JS before 2014.


It would be a mess, as JSX is syntax that calls to a specific library function.

There would likely need to be some new kind of syntax delimiter for it to be a native feature. E4X-style would conflict with JSX-type syntax.


for sure not suggesting using E4X as it is, JSX has evolved a lot from E4X. For example, as small implementation such as https://nanojsx.io would be a good start.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: