Live data from Hacker News

Please just try HTMX

pleasejusttryhtmx.com

501–510 of 530 posts

Re: Please just try HTMX

#501
post #389

Threads like these make me glad I’m not a frontend dev. Just looking at the comments it’s clear there is no cohesive view or vision or agreement. One giant Tower of Babel

There is a cohesive view, vision, and agreement in web dev: HTML, CSS, and JavaScript. There are web standards, web APIs, and accessibility requirements. Everybody builds on top of that.

Re: Please just try HTMX

#502

Earlier quoted context omitted.

> 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 l…

> it genuinely does make the...users happy

But you have no idea if it does that, you just have the word of the PO who's not actually building anything, they're at best just copying what others are doing (ie being derivative) or at worst just doing guesswork.

How about offering an alternative: a UI/UX that takes the web as it is, a primarily document-based format with navigation and data entry? A lot of cool stuff can be built on top of that.

Re: Please just try HTMX

#503

I would recommend https://data-star.dev over htmx. It is more complete. But it depends on what you are building. Datastar does everything that htmx can do and much more.

It doesn't have history support out of the box. I consider that essential for hypermedia apps. When I'm loading fragments into my page I need to push the URL of the fragment I just loaded so the user can reliably come back to that specific resource later.

Re: Please just try HTMX

#504

I just don't like having to send HTML and have the backend deal with what are really frontend problems. Sending JSON is great since you can serialize most reasonable data types into it and then the backend has no responsibility for how it is rendered which helps for having mobile apps use the same backend as the website. Sending HTML just seems nuts since if you change your design you would have to change the backend…

See this subthread https://news.ycombinator.com/item?id=46315559

Re: Please just try HTMX

#505

What's the grug brain method of "live updating list with a search bar". I tried htmx sse but it turned out to be not that great. I was hoping I could model it as a single request/response cycle like a traditional page post, with the astericks that the single response is actually a stream of responses. Clicking search or whatever again "just" axes the old request and sends another one with the updated parameters. Perh…

https://htmx.org/examples/active-search/

Re: Please just try HTMX

#506
post #496

Earlier quoted context omitted.

What are you guys talking about. It automatically redirects to the HTTPS version and the cert is signed by Let's Encrypt.

You are late to the party, and it's already fixed. > It automatically redirects to the HTTPS version That's your browsing doing the job, not how the site is set up.

Which browsers are not doing this?!

Re: Please just try HTMX

#507
post #362

Earlier quoted context omitted.

But the front end code is in one place, and that place is the server. It is true, though, that the experience greatly benefits the easier it is to manage and return partials from backend code. Some frameworks make it harder than others.

I'd rather have the often loaded static html running on a server that is optimised for that job, or served from a cache close to the user. The backend can then just serve up the dynamic content and be optimised for that job.

The 'often loaded' static html won't help if the 'often loaded' JS bundle is re-deployed (eg, when the devs make a 'small' change) and the cache is invalidated. In that case all the users will be forced to reload the giant JS bundle over and over again, as opposed to just reloading a single resource on a single page like they would with the htmx approach.

Re: Please just try HTMX

#508

Earlier quoted context omitted.

In the simplest web server, the server returns HTML. Having the backend return JSON is where you're adding complexity. Your front end code won't even work without some base HTML.

Having the html stored both on a static html site that can be cached and in the code base of a backend server is more complex to me than keeping these concerns separate.

That's why you just have the HTML in the backend server codebase...which can also make sure it's cached properly with HTTP caching techniques like last modification time, ETag, and so on.

Re: Please just try HTMX

#509
post #417

If you don't need React, you probably don't need a framework anyway. The reason I use React is to create components that can exist on their own (and can be constructed/visualized on a StoryBook) and these components will then play nice with other React components. And then use JSX to make reasoning about the code simple. That's not what htmx is. > htmx is a library that allows you to access modern browser features di…

One would think so, except we are constantly seeing people creating React apps that should have been a few simple HTML files and some JS.

Re: Please just try HTMX

#510

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.

Except it's not a language. It's a library. Both of them are, in fact.
Post reply on HN