Ask HN: Why do you all think that Htmx is such a recent development?
As far as I can tell, all the necessary tech was there in 2005, with ajax. So I am curious why it was developed after react, despite being so much simpler in concept/aligning more with how websites used to be developed before rendering on the client became that popular.
59 comments
[ 4.4 ms ] story [ 77.9 ms ] threadHTMX leaves that component problem to the server side templating instead and IMHO that is a far more loose and leaky abstraction.
Yeah, that seems to fit as the cause quite well.
What these all do is they allow using the full power of your programming language to create component-like abstractions much like you would in React. I show an example of this with my own library: https://github.com/yawaramin/dream-html/tree/todoapp/app
2. It takes time for mindshare to become disenchanted with something that is heavily pushed
3. Average experience level needs to rise to a certain level to appreciate that fewer features that compose better is superior to many features that aren't made to be composed.
Sometimes that's just too much, and having a nicer alternative to do some ajax calls that doesn't suck like jQuery is nice.
While not quite the same, we have seen similar takes, for example with Webforms, where the functionality resembles what some people are doing now with Hotwire, LiveView, Blazor, StimulusReflex, et al.
Also, I recently tried to use htmx in my project and ended up switching to web components because I just needed more control over what happened when events arrived. htmx was definitely making it more complicated.
From what I’ve seen of htmx, we did have something in the same vein back in those days, albeit in a more adhoc manner.
For our part we built a lot of sites that were quite content heavy with a sprinkling of interactivity. Think blogs with comment sections. By the time I stopped doing that, the pattern we had settled on was loading the comments with the page (server rendered html). When someone posted a new comment (json) we returned the rendered comment as html and injected it in place. It worked well because we could share the same template fragment for a single comment and use it in the initial render loop.
As I say, don’t have experience with htmx so maybe my understanding is off.
I haven't used htmx, but if I'm not mistaken it uses plenty of tech that is more recent than 2005. HTML5 wasn't even released yet and the JS DOM was far from a standardized thing that you could expect consistent behavior across browser vendors. I doubt htmx developed back then would look anything like it does today.
We’re starting to (re-)discover that you can build interesting, profitable products that are technically boring.
HTMX is a wrapper around old functionality pitched to devs that learned that frontend "really, really needs" all the complexity. It's being used by people who never needed all that complexity for tasks that didn't need a whole frontend stack.
Of course it fits them better than the alternative that they have heard about being the only modern way to build apps (a massive frontend stack where the framework isn't even a framework anymore so we built another framework around it).
The thing that htmx users often miss is that you can have most of those nice things without pulling in htmx, htmx is definitely not right for most use-cases, htmx itself is quite the large JS dependency (and you still need to write JS to use it properly), it's not "just hypermedia", and on and on.
Personally I think the solution-space that HTMX fits in is extremely narrow between normal HTML/CSS/JS and "fuller" frontend apps (hopefully built on lighter stacks than the current react meta).
> the solution-space that HTMX fits in is extremely narrow
Strong disagree. HTMX is extremely flexible, surprisingly powerful and fully capable of driving quite a wide range of web applications. HTMX + Alpine even moreso, while still being far less complicated than one of the big 3 frameworks.
React, Angular, Vue
The existence of "many other smaller frameworks" is nice because it provides additional options for developers, but does not diminish HTMX's utility or suitability to drive a web application.
HTMX isn't even the biggest one outside of what you called the "big 3".
Sure, you could do the basics of that workflow with twenty lines of your own JS, and save a dependency. But that's the kind of thing that is generally very unscalable, because unless you're very disciplined it quickly becomes a mass of spaghetti. The virtue of HTMX is more in how it channels and limits your code, than in the new capabilities it grants you (which were all in common use as of 2005 or whatever).
It is one order of magnitude easier to ship a software to the last version of the major browsers than supporting all older versions of them including IE with disabled javascript.
Also in that era: adding onclick to elements that semantically should never have onclick and won't have correct focus behavior and won't show up in the screen reader rotor and, and, and. And now HTMX has "When a user clicks on this div" in its docs. Some things are best left in the past. That really bums me the fuck out.
This is why tools like Alpine and HTMX are now gaining popularity. Personally, I am excited to get away from React/Vue etc even though they have their place.
"Back in my day we used <table> for layout." - Me (Oh the horrors of that)
Component driven development goes all the way back to things like Visual Basic development of apps on Windows platforms (like Windows 3.11) or the equivalent on Apple back then. We have taken a document driven technology that was HTML docs linking to other HTML docs and bastardized it into building applications with heavy UX/UI requirements that replaced the VB apps and mainframe green screens of their days. I'm not dissing it, I've spent a career building web apps with it, it just was not the intended use of HTML.
There have only been a couple of technologies in the last 25+ years that I remember where components really were a first class citizen and those were when it was not HTML/CSS and it was the browser ceding control to something else like Java Applets or Flash. I haven't paid attention to WASM but I was thinking something similar would come out of that where you could use the web as a delivery platform and ignore HTML/CSS for the most part and leave that for docs.
The pendulum is swinging back towards more server-side rendering.
Making standard forms refresh with dynamic server content was one of its core competencies, and One of the big things Htmx does.
Htmx isn't anything novel. It's all been done before.
Then someone said, "Sending HTML is old news; let's send JSON on the back end and reassemble everything with JavaScript." So we did.
Then someone said, "Why don't we put everything in a single file and call them components?" So we did.
Then someone said, "Why don't we push those components from the server instead?" So we did
Wait a minute???
Whatever comes next in the mainstream frontend space must look more complex than React and friends. Money is at stake.
Generally agree, but I do want to point out that frontend devs who truly understand HTML and CSS on a deep level are worth their weight in gold.
Compare someone like Kevin Powell to your average frontend dev when it comes to markup and styling.
jQuery said: Vanilla JS is too unstructured and results in messy code. So, it gave us a library of convenience methods that standardized and simplified common functions.
React and Angular said: jQuery is not powerful enough to support our complex web apps. So, it gave us the virtual dom and client side state to simplify SPA development.
Htmx is saying: React and Angular are too bloated, you don't need client state or dom manipulation most of the time. So, it's designed to be a lightweight extension of the "declarative web" with functional tags for common cases.
But i'm not so sure htmx has solid footing yet. for developers considering using htmx, they'll ask themselves: if my app is so simple that it can be made using htmx, then isn't so simple that it can be made without it?
Great point and something I am looking at myself. With libraries like Alpine that gives you powerful JS capability to sprinkle in server side code, I am trying to see if I can get away with vanilla JS for what HTMX is doing.