3 ms·
> Mixing HTML and JS is not elegant at all. Unless you know LISP, then you understand code is data.
by hcarvalhoalves 11y ago
> Mixing HTML and JS is not elegant at all.
Unless you know LISP, then you understand code is data.
- davexunit 11y agoTrust me, I know Lisp. In Lisp, there's built-in templating via quasiquote, so we can easily construct HTML documents by first writing them as s-expressions. JSX is a far cry from how Lisp does things. You get all of the nastiness of the redundant typing involved with hand-writing HTML mixed in with your JavaScript, plus the addition of another compilation step in your build! I like Mithril's virtual DOM API[0] much more. It's really pleasing to use, but of course not as good as SXML in Lisp because JavaScript doesn't have macros or quasiquote. [0] https://lhorie.github.io/mithril/mithril.html https://lhorie.github.io/mithril/mithril.html
- Touche 11y agoBut JS isn't lisp, and to manipulate it you have to turn it into an AST and traverse it with a lot of extra tooling. It's not as (easily) pliable as lisp.