logoalt Hacker News

ZjsComponent: A Pragmatic Approach to Reusable UI Fragments for Web Development

61 pointsby lelanthran06/16/202542 commentsview on HN

Comments

lelanthran06/16/2025

Shameless plug; I'm the author. Criticism welcome.

I use this for client-side includes and web components.

No build process, no web-packer, no framework, no npm requirement. Just include the JS in your HTML and then you can create and include components.

show 5 replies
willmeyers06/16/2025

For anyone curious, the source code: https://github.com/lelanthran/ZjsComponent/

amingilani06/16/2025

Hate to be the one to pull a dang, but, remember:

> Be kind. Don't be snarky. Converse curiously; don't cross-examine. Edit out swipes.

https://news.ycombinator.com/newsguidelines.html

hirako200006/16/2025

I came across Yoffee, also requires no specific build system or dependencies. Proposes to either code native web components, or not. No web components means instances are used to get fragments, and still support a state store. Not only one state store can be passed over to instance, as many as we want.

Can you compare with ZjsComponent?

Pure html and JavaScript from my experience is a relief, I still stuff the trauma of seeing jsx error cluttering the console with barely anything useful to troubleshoot.

How doé ZjsComponent compare, any advantage with your paradigm?

sandreas06/16/2025

I like vanilla components... Personally I think that instead of providing either frameworks or vanilla compnents, frameworks should provide a way to compile components to independant vanilla JS (similar to svelte not needing a "runtime").

This way it would not matter this much how you deploy components and this compiling step could probably have its own API with hooks and callbacks.

show 1 reply
pointlessone06/16/2025

It’s remarkable that you can write a paper about a 100 lines of code (literally). Maybe I should try that some time.

show 1 reply
lacoolj06/16/2025

This kinda reminds me of a slimmed down version of Polymer.

I like the simplicity, and it might have potential to stack upon itself to provide the other missing elements like reactivity, etc.

Keep up the good work

krystofee06/16/2025

Is there some clean way to pass components or just html to components using this framework without having them in strings? This is issue I see with most of these approaches.

show 1 reply
ilarum106/16/2025

This is cool. Remindes me of simplicity of https://tg.pl/drab which need phoenix/elixir.

mosdl06/16/2025

Seems to be taking how old frameworks used to work in the old days (download some html/js and run in an closure) and wraps it into webcomponents. Neat, but not sure why its a paper.

show 3 replies
chistev06/16/2025

[flagged]

jebronie06/16/2025

[flagged]

show 1 reply