Much more prefer the htmx way of SSR parts of the page dynamically. Also, totally server-side agnostic, so we can use what we prefer. Clojure in our case.
HTMX has to be my favourite thing web related. I never really got React and always found it a bear to setup and use, but HTMX and server ride rendering? Easy and extremely productive for a non-frontend guy like me.
I really hope it or something like it becomes popular long term.
I just started using htmx in a new personal project. I’m pretty excited to see how it goes. I’m doing a sort of back to basics stack with PHP, simple classless css lib and htmx. So far it’s been a refreshing experience
Yes indeed! The core aspect, however, is that your server is returning fragments of html that htmx places in the DOM extremely quickly. They have pretty good examples on their site illustrating some "modern" UI patterns.
As an example, you may have an HTML table on your page that you want to insert a new row for some reason on let's say a button click. You place some attributes that htmx understands on your button that will call for the TR HTML chunk from the server. You can imagine replacing all the rows for a paging click etc.
Versus the overwhelmingly common SPA counterexample where any change in the UI means sending a request to the server, waiting for it return your json response, parsing that json response, building html out of that json response, and updating the dom.
I built a tiny deno+htmx experiment, you can check it out at https://ssr-playground.deno.dev, it's all server-side rendered html with htmx attributes sprinkled around.
I love the concept, but for my case, I'd need more granular filters. In particular, I only buy TVs that have analog audio outputs so I can hook them up to any speakers. That's a minority of TVs these days, but there are still a few around. Finding the good ones would be useful to me.
Can the same server side code render that fragment, regardless of whether it's part of the initial page load or a subsequent update? You need an additional route for the Ajax call, right? Just curious how this gets structured.
I haven’t used it recently but I believe it sets a header on the request when it comes from HTMX so you can change whether you send the whole page or just the fragment back.
You can also just send the whole page and use other features to select just the part that you want to update (obviously that has a cost of sending the whole page though).
BizarreByte|3 years ago
I really hope it or something like it becomes popular long term.
duncan-donuts|3 years ago
mmcnl|3 years ago
robertoandred|3 years ago
silver-arrow|3 years ago
As an example, you may have an HTML table on your page that you want to insert a new row for some reason on let's say a button click. You place some attributes that htmx understands on your button that will call for the TR HTML chunk from the server. You can imagine replacing all the rows for a paging click etc.
Again check out the example for cool stuff.
the_gastropod|3 years ago
mehphp|3 years ago
It's not suitable to everything, but it works really well. I'm not advocating switching to it right now, but it's looking very promising.
dsego|3 years ago
greg_tb|3 years ago
For me the biggest advantage is eliminating the need to learn, debug, and maintain components on an additional frontend framework (Angular/React/Vue).
I just built a rough toy project [0] that was my first time with FastAPI and HTMX and it was fun and fast.
[0] https://www.truebuy.com/ (like rotten tomatoes for product reviews but just for TVs right now)
recursive|3 years ago
unknown|3 years ago
[deleted]
0xdeadbeefbabe|3 years ago
unknown|3 years ago
[deleted]
satyrnein|3 years ago
codingkoi|3 years ago
You can also just send the whole page and use other features to select just the part that you want to update (obviously that has a cost of sending the whole page though).
jhot|3 years ago
silver-arrow|3 years ago
unknown|3 years ago
[deleted]
unknown|3 years ago
[deleted]