Show HN: Tiny JS – A Tiny JavaScript Library for Easy DOM Creation (github.com)
Hi everyone, the other day I was here cause I thought I came up with a neat way of creating HTML via JavaScript [1] - After some iterations, I'm quite content with the code I wrote. Since I intend to use this in my personal projects, I thought others might as well.
5 comments
[ 5.0 ms ] story [ 20.9 ms ] threadIn case you didn't see it, they meant this [0] and also this [1].
I don't mean this as a critique or dismissal of your idea, but I think it's fair to prefer Hyperscript since it's well tested code and has a couple of additional features (like event handler support) without being much larger than your own code. Also, I think Hyperscript is more correct in the way they build the elements.
[0] https://github.com/hyperhype/hyperscript
[1] https://github.com/ohanhi/hyperscript-helpers
> I think it's fair to prefer Hyperscript
It is.
https://chatgpt.com/share/d38144b6-d088-4887-a2d2-50b931c6af...
One thing it got wrong is that TinyJS can handle events, you can just pass a onclick property via props and it will work `div({onclick: () => alert(1)}, 'click me')`