Re:What if we'd had better HTML-in-JS syntax all along?
by adambard on Monday May 11, 2020 @12:23PM
(#23143816)
The "object" syntax reminds me a lot of Clojure/script's Hiccup (https://github.com/weavejester/hiccup) style, which has become a de-facto standard across many popular libraries. In hiccup, this example:
Would be represented as:
[ Parent
| on HN ]
Re:What if we'd had better HTML-in-JS syntax all along?
by jwr on Monday May 11, 2020 @12:55PM
(#23144262)
Thanks for mentioning this. I was about to say that those of us who write ClojureScript do not have the original problem: my functions return vectors with data, which then get turned into HTML, DOM objects, or React classes, depending on the specific use case.
In other words, there is only one language and one syntax to deal with.
Re:What if we'd had better HTML-in-JS syntax all along?
by austincheney on Monday May 11, 2020 @04:02PM
(#23146337)
That looks identical to WC3 XML Schema language using JSON syntax instead of XML syntax.
Re:What if we'd had better HTML-in-JS syntax all along?
by quietbritishjim on Monday May 11, 2020 @08:52PM
(#23149365)
I think you've missed that the hiccup example is the code on the final line.