3 ms·
This page illustrates why I just don't get HTMX. It seems like a ton of effort to save not a lot of server cycles and html over the wire. I've done tabbed UIs
by treis 3y ago
This page illustrates why I just don't get HTMX. It seems like a ton of effort to save not a lot of server cycles and html over the wire.
I've done tabbed UIs that worked like HTMX. But instead of trying to do div surgery it replaced the entire tab. It was like 20 lines of JS and a few lines in Rails to render without a layout based on a URL query param.
When we're talking dozens of KBs of HTML for a tab it's not the extra complexity to try and slim that down.
- mejutoco 3y agoHtmx advantage is not that it sends less bytes, but that it effectively removes frontend. Getting rid of the frontend dependencies, builds systems, and languages can bring a lot of speed to a project. Of course the downside is everything must go to the server. While not perfect, many spa also do not work nicely without a connection, although they could. Another thing is that the templates can get a bit crazy quick. I found a good solution is to use swap-oop (https://htmx.org/attributes/hx-swap-oob/ https://htmx.org/attributes/hx-swap-oob/) for everything and have a "component" wrapper server-side to abstract the ids and which template to choose. Then, some kind of typed data structure tracking all the element ids, since you need to refer to them from the templates to know which element to update. This way you can easily find all the templates that update a specific id or all the ids that are updated by a template.
- treis 3y ago>Htmx advantage is not that it sends less bytes, but that it effectively removes frontend. Right, which you can achieve by replacing the main content div. HTMX takes it many steps further and allows you to slice the HTML up into small bits and replace only those. This adds a lot of complexity for little benefit.
- mejutoco 3y agoIt achieves it by not needing React, etc. IMO. That is the benefit. It might be worth it or not depending on the project.