Live data from Hacker News

Please just try HTMX

pleasejusttryhtmx.com

421–430 of 530 posts

Re: Please just try HTMX

#421

Earlier quoted context omitted.

> n a plain JSON world, I'd craft a single "user" endpoint, returning those three datapoints, and I would let the frontend handle it. The main problem is that this is extremely, extremely expensive in practice. You end up in Big Webapp hell where you're returning 4mb of data to display a 10 byte string on the top right of the screen with the user's name. And then you need to do this for ALL objects. What happens if a…

> What happens if a very simple page needs tiny bits of data from numerous objects? It's slow as all hell, and now your page takes 10 seconds to load on mobile. If you just rendered it server-side, all the data is in reach and you just... use what you need. You went on a long tirade against REST, which nobody mentioned. Just ... write an endpoint returning the data you need, as JSON? But write it once, instead of onc…

> Now you need the exact same data but displayed differently. Boom, another 100 lines of code? Multiply by the number of times you need that same data? Boom indeed, it just blew up.

It isn't 2004 anymore - all of the server-side frameworks have components.

Except, now instead of using serialization and JSON, it's a real API. In code. I can click and go to definition.

> Just ... write an endpoint returning the data you need, as JSON? But write it once, instead of once per view variant?

What you just said directly contradicts itself.

If each view variant needs slightly different data, or ordering, or whatever, we now need to make N APIs. Or we don't. And now we're back at square one and everything I said is valid.

The more modular and reusable your API is, the less performant it will be and the more bugs it will introduce. I'm all for the God API that has 1 million endpoints each doing one specific thing. But it seems nobody else is, so instead we get the fucked ass RESTful APIs that are so bad and lead to such overly complex code were pushed to write critical CVEs to avoid them (looking at you, NEXT)

Re: Please just try HTMX

#422

Earlier quoted context omitted.

> This isn't about state, is it? In a classic react app, if I need to display the name of a user, then I fetch it (from the server) once, and display it as many times as I need, in as many forms as I need. There's only server state. No, there's two states here: the frontend state, and the backend state. The name example is trivial, but in real applications, your state is complex and diverges. You need to constantly s…

> These are hard problems. I fail to see how HTMX helps. I fail to see how SSR necessarily helps too. You could be serving a page for an order that's been cancelled by the time the user sees it. > I put in some search criteria, maybe a check a few boxes. Refresh? All gone You could see that 20 years ago too, unless you manually stored the state of the form somewhere. Again, what does it have to do with HTMX, or Rect,…

> You could see that 20 years ago too, unless you manually stored the state of the form somewhere

See, that's my point - it's NOT manual, it's explicit. There's a difference. A form submission and page refresh is just that. It's very clear WHEN the sync happens and WHAT we are syncing.

With a SPA, you throw that all away and you have to do it yourself. And it's almost always done poorly and inconsistently.

Re: Please just try HTMX

#423

Hey, I created htmx and while I appreciate the publicity, I’m not a huge fan of these types of hyperbolic articles. There are lots of different ways to build web apps with their own strengths and weaknesses. I try to assess htmx’s strengths and weaknesses here: https://htmx.org/essays/when-to-use-hypermedia/ Also, please try unpoly: https://unpoly.com/ It’s another excellent hypermedia oriented library Edit: the arti…

I'm curious if the author of the article is an HN reader, and if yes, how this comment is received.

I'm the author of the original article. fwiw, I haven't seen anything that bothers me.

And if there was originally a harsher response which I missed, well then I hope it wasn't merited.

I'm pretty light-hearted about this topic! It's more fun that way.

Re: Please just try HTMX

#424

Earlier quoted context omitted.

You need to get out of the mentality that there have be two states. Ultimately the frontend state cannot exist without the backend, where data is persisted. Most apps don't need the frontend state, all it really gives you is maybe a better UX? But in most cases the tradeoff in complexity isn't worth it.

This isn't about state, is it? In a classic react app, if I need to display the name of a user, then I fetch it (from the server) once, and display it as many times as I need, in as many forms as I need. There's only server state. I don't see how it's any simpler to shift partial presentation duties to the backend. Consider this example: https://htmx.org/examples/active-search/ The backend is supposed to respond with…

> Something as simple as changing the order of the columns would require three releases

Just change that example to just return the entire table element on /search. You could even add/remove columns with a single route response change, vs the multiple changes required to sync the front/backend with a JS framework.

Re: Please just try HTMX

#425

Earlier quoted context omitted.

I don't think this is straight LLM, it's probably an homage to a line of websites like https://thebestmotherfucking.website

For sure the author had an idea and went to the LLM to produce the post. And I'm aware of those prior sites (some of which are linked at the bottom.) I mean nothing is straight LLM, you must prompt them and people are putting their ideas in and linking to other sources and getting stuff like this out. And hopefully editing or iterating, but not enough it would seem most of the time. I'm saying their perspective doesn…

I get it. Sorry if I wasted your time.

Re: Please just try HTMX

#426
This reminds me of Subreply (subreply.com), a tiny text-only social network that keeps things extremely simple and fast—worth checking if you like minimalism in apps.

Re: Please just try HTMX

#427

I like HTMX, I use it on my blog. But I will say, in the niche where I need some dynamic DOM changes without needing a full-blown SPA, raw JavaScript with some basic utilities like jQuery is not so bad. The issue with htmx is that it is fairly prescriptive of how one should go about building dynamic interactions, and it becomes complex quickly if the dynamic interaction is more than trivial. I don't disagree with its…

> it becomes an issue when my product owner tells me that I need to do some funny dynamic thing Okay, but on the other hand maybe you should do the right thing and say no.

I agree that one should push back, but I suspect we have different notions of when to do that (which is fine, my approach here is not fixed in stone). Making a page needlessly dynamic would be a concern for me if it violates business rules or for whatever reason harms the overall system. But if it doesn't do that, and it genuinely does make the business and users happy, then I'm happy to do it and then get a bit of leverage to take some time to tackle tech debt that needs addressing on the backend.

Re: Please just try HTMX

#428

Earlier quoted context omitted.

> Resume-driven development should not be a thing. Pretend this is not about library choice, but rather about language choice. One language has 2 jobs, and the other language 13k jobs. I doubt you'd think for more than a second.

> One language has 2 jobs, and the other language 13k jobs. I doubt you'd think for more than a second. The Hacker News website runs on Lisp. How many jobs do you see on the market that ask for Lisp? And yet, for what it is, this site is amazing! I don't see them rushing to migrate to a python backend and a react-based frontend, no matter how many jobs there are for those.

this site can also vibe coded in seconds.

Re: Please just try HTMX

#429

Can we see a styled date-time picker in htmx?

Yeah, https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

I can tell you, it is neither styled, nor does it work on Firefox (as in, properly works). And the mobile UX is horrible.

Re: Please just try HTMX

#430
I used Turbo + Stimulus with a CodeIgniter PHP backend. Later, I used an HTMX bot with CodeIgniter and GoLang. Now, I have migrated my second brain web app (Brainminder) from HTMX to Unpoly.

I really liked HTMX, and I thank the authors for this marvelous library!

I switched from Turbo to HTMX because the latter is much more flexible, and I try to avoid Node.js as much as possible, only using it to compile some JavaScript code for Stimulus.

I finally moved from HTMX to Unpoly for the following reasons:

1. Layer support: Unpoly makes it easy to create layers and modal overlays, saving a lot of time and JavaScript code. You can achieve the same functionality with HTMX, but you have to write more code.

2. JavaScript code is better organized thanks to up.compile hooks.

3. HTMX and Unpoly treat fragments slightly differently. With HTMX, you have to use an out-of-band feature to update multiple fragments together. With Unpoly, you can easily add them to the response (and declare them in the front end, of course).

In my opinion, Unpoly has a better-organized approach to everything. On the other hand, apart from the official documentation, it is difficult to find examples for some edge-case features.

Post reply on HN