top | item 41272440

(no title)

drikerf | 1 year ago

Nice project! I do wonder though if jsx is the best way to represent elements in code?

Clojure datastructures makes this so much more enjoyable. Everything is just basic lists and maps which makes it very flexible and powerful.

[:ul [:li "task 1"] [:li "task 2"]]

It's weird that it's not more common for making web apps.

discuss

order

edflsafoiewq|1 year ago

There are a lot of DOM util libraries that look like

  h("ul", h("li", "task 1"), h("li", "task 2"))
This is called "hyperscript-style" after an early library that used it. This is basically what JSX compiles to too. There used to be a lot of JSX vs hyperscript debates.

There's also variants like h.ul(h.li("task 1"), h.li("task 2")) using Proxies now too.

globular-toast|1 year ago

There is a library for Python called htpy that does this.

Trouble is if you're used to HTML it can take a while to get used to it. It's like a learned helplessness or something.