Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

As I understand it, HTMX front-end components aren't re-usable in the same way as ReactJS components.

HTMX components are 1:1 coupled with back-end code. So if I try to build a complex UI with nested structures, I'm going to have to build a parallel structure in back end.

The back end will have to manage all state, so there will be round trips for everything and things in server side memory that could be managed easily on the client side. That would affect the scalability and maintainability.

I'm not getting a sense of why HTMX would be better than a pure client/server approach. I have no attachment to "hypermedia," or any other concepts penned in the 1960s!



I don't know what you mean by reusable: you can reuse anything you create on the server side via various techniques (e.g. template inclusion, or using something like JSX for SSR, etc.)

A complex UI with nested structures covers a lot of area: the DOM is fundamentally a complex UI with nested structures. I'd need more specific examples to say anything intelligent about it.

htmx certainly doesn't necessitate round-trips for everything. HTML itself doesn't (see detail elements and HTML5 form validations) and client-side scripting is perfectly compatible with htmx:

https://hypermedia.systems/client-side-scripting/

htmx is better than a pure client/server approach in some cases because it relies on the already-built hypermedia client, the browser. This can, in some cases, dramatically simplify & improve applications:

https://htmx.org/essays/a-real-world-react-to-htmx-port/

(67% reduction in LoC, 96% reduction in dependencies, halved memory usage, 50% decrease in first load time)

Looking at your application, it appears to be amenable to the hypermedia approach, but I didn't do a deep dive on it. OTOH of course, if you are happy with the current approach I don't see any reason to move to hypermedia for its own sake.


Interesting. Thanks for the details, and for the link to the React->htmx migration.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: