Description
I'm new to htm. I like it. I chose it because it can be used with Preact in a no-build environment, i.e. our micro-frontend app will use https://esm.sh/htm/preact/standalone
at runtime.
However, I'm a bit confused as to whether htm wants to be more like HTML or JSX. The docs say JSX-like, but there's differences...and those differences seem to more align with vanilla HTML and JavaScript. Well, sort of.
I see support for class
instead of className
, which is great and I understand that's more of a Preact thing, but then I see onClick
used here in the docs instead of onclick
. Both work, and I prefer the HTML style, but it feels like htm doesn't know what it wants to be. This is made more confusing because void elements like <img>
don't work. You apparently have to self-close them as if this were XML. But then non-void elements like <div></div>
can be self-closed, which is not valid HTML.
Are there docs of some kind that go into this in more detail? I feel like I'm gonna keep finding more gotchas like when you first start using JSX. Can't a dev just write some HTML anymore😭