Post #2650687
2024-12-27 20:33 UTC
This post brought to you by the htm library for JS. It converts your jsx-looking string to HTML, without using JSX.
The code strikes me as elegant.
When I pass an extra closing tag, the exception says "h.push is not defined"
When I miss a closing tag, it returns the wrong type.
https://www.npmjs.com/package/htm
Replies (1)
-
@jessitron@hachyderm.io 2024-12-27 20:35
so I wrapped it in bumpy code, to at least give my future self a better hint. https://github.com/jessitron/hny-tricks/blob/1e90435b00ebc7911423471f17259c7c5d4f9ff6/src/htm-but-right.ts