Live data from Hacker News

htmx

htmx.org

191–200 of 291 posts

Re: htmx

#191

Earlier quoted context omitted.

Never seen a tool where the people who don't use it seem to make up some of the craziest, most obscure, weirdest justifications for avoidance. It's totally fine if you're not personally down with HTMX! However, stating that we're avoiding "idiomatic code" is incorrect. Are you claiming React and JSX and useEffect are idiomatic? Really? Surrounding HTML fragments with return() and attributes with braces is idiomatic?…

Here's some code that I don't find especially idiomatic: It has a multiline HTML attribute value and an unfamiliar programming language with the english word me that is sure to be confusing to some who don't speak it as a first language. https://htmx.org/docs/#validation-example

Non native speaker here.

The unfamiliar programming language (which I've never used) seems to be binding some code to some type of validation event. "my" and "me" seem to refer to the input tag. "my.value" probably refers to the value of the input. If it's not foo it calls a setCustomValidity method with the input tag as the caller. Could be some built in method that you can call on any input tag or anything validatable.

Ok I just checked the link and setCustomValidity is part of the HTML5 Validation API (haven't worked on web dev in years).

I can assure you that the first person pronoun is among the first things we learn when studying English and assuming the code snippet does what I assume it does I'd say it's pretty intuitive to learn. Especially if we are comparing it to JS where "this" is not what you'd expect from using it in other languages, but the late-bound called of the function... except in all the cases where it isn't.

In any case, trying to guess how a programming language works is a very bad idea so it doesn't matter how obvious the language manages to be, you still should read the documentation.

Re: htmx

#192

HTMX + Java is almost as good as react! I think people mistake what htmx is - they think it is a way to not write react/js in a node environment. Where HTMX really shines is being able to bring the experience of writing React-like code without a nodejs environment in Java for e.g. (or Golang, Rust, etc)

> Where HTMX really shines is being able to bring the experience of writing React-like code without a nodejs environment.

FWIW, if that's all you're after, and you've mastered the Rust borrow checker, Yew (a React-like experience), or Leptos (a SolidJS-like experience) might be interesting to look at.

Re: htmx

#193
post #121

Hmmmm... no. This: Click Me Should be just this: Click Me This way, no magic would be needed, a lot of indirection and complexity would be avoided and everybody who knows HTML and JS could immediately read and understand it: - When does something happen here? When the button is clicked. - What does happen? htmx.post() is called.

You are missing the fact that html has very restricted list of events that can be defined in an attribute. Htmx allows to listen on any event, plus some extra features on top, such as event throttling, polling, synchronization between elements. Stylistically I can see the appeal of your proposal and even agree on some ways, but it's not functionally equivalent

https://htmx.org/attributes/hx-trigger/ https://htmx.org/attributes/hx-sync/

Re: htmx

#194
post #3

Can HTMX be used with static site generators, such as Hugo, to create interactive documentation websites?

Why does documentation need any JavaScript at all beyond opening the hamburger menu?

No need for javascript for the hamburger menu, it is doable with CSS checkbox, see for example the hamburger menu on https://lanyon.getpoole.com/ .

Or another example, the teddit reddit-frontend has collapseable threads with the summary/details tags, also works without javascript.

Re: htmx

#195
post #34

Earlier quoted context omitted.

> You could follow something like this: https://learn.svelte.dev/tutorial/welcome-to-svelte I think if you are, like me, someone who for various reasons never followed the JavaScript ecosystem for various reasons over the last few years (in my case because I was working on exclusively backend APIs in C#), coming back into trying to do any frontend website is just ten thousand people saying "it's not that hard, just f…

I doubt it – I haven't seen any indication of HTMX being a silver bullet. Here's your list of examples: https://htmx.org/examples/ Here's validation: https://htmx.org/docs/#validation-example It looks kinda like ruby.

It is explicitly NOT a silver bullet

https://htmx.org/essays/when-to-use-hypermedia/#hypermedia-n...

Re: htmx

#196

Seems like a horrible idea that totally breaks separation of concerns, so I’m sure it will be a huge success you’ll see everywhere very soon.

There are multiple ways of separating concerns. Htmx is faithful to the original HTML separation of structure / presentation / behavior. Elm cuts this way too but with a completely different approach. React does components. Pick your poison because in any case there will be crossing of those concerns. Personally I've never seen react code that doesn't go sour beyond a toy demo.

More of an Angular fan though I haven't used post 1.x much.

Re: htmx

#197
I really want to use htmx on the next project but I am not sure how to make it handle poor network connections yet. The app I'm building will be used in areas with poor mobile connections - I want to submit a form, add it to a list and say it's pending saving, while the user can add more. Have to use hyperscript probably?

Can trivially do it in vanillajs so I'm sure it's possible?

Re: htmx

#198
post #162

Earlier quoted context omitted.

Because the originals parts where broken. I am speaking of 90s JavaScript, the DOM/Browser API and the not so much "batteries included". They could neither get fixed without a standard by committee approach of the browser vendors. So we started to compensate: end state: Typescript to fix JS, React/Angular/Svelte to fix DOM API and a npm package hell to have batteries included. And all of that bundles, compressed, etc…

Yes. When JavaScript is your only option, the only solution to JavaScript is... more JavaScript :(

Seems like the old joke about XML:

"XML is like violence: if it doesn't solve your problem, you're not using enough of it."

Re: htmx

#199

Earlier quoted context omitted.

I doubt it – I haven't seen any indication of HTMX being a silver bullet. Here's your list of examples: https://htmx.org/examples/ Here's validation: https://htmx.org/docs/#validation-example It looks kinda like ruby.

It is explicitly NOT a silver bullet https://htmx.org/essays/when-to-use-hypermedia/#hypermedia-n...

I'd like to point out that if you require offline functionality in one project that it likely isn't a good fit for your other project that doesn't require offline functionality. We all have finite time and it's great to learn something once and be able to use it multiple times.

Re: htmx

#200

Earlier quoted context omitted.

If people are "misinformed", that's a marketing fail by those other frameworks, despite many years of headstart. How are people even finding HTMX (with a single developer and until very recently, no corporate support) in a marketplace which includes Angular, backed by Google? Or maybe people are kinda informed, and simply drawn to HTMX because it's easier to learn than Vue, Svelte, Mithril, Cycle, whatever (or they j…

> or they just don't want to try a zillion frameworks But isn't HTMX one of said zillion frameworks? What makes it any different?

It's easy? It works? It feels like HTML? No build steps? No JSON? The primary documentation fits in a single page? Most common patterns (i.e. polling, and then stopping if necessary) are built-in? Because fundamentally, it's just standard HTML forms? The entire dev experience is focused on a single application (backend) as opposed to writing a backend and a seemingly separate frontend project, in a different language (unless you use JS on the backend)? Simply replacing HTML fragments is conceptually simpler than maintaining a shadow DOM? It embraces web standards/APIs (see client validation discussion above)?

Here's polling in Svelte: https://stackoverflow.com/questions/61391174/how-to-do-polli...

and in HTMX:

  hx-trigger="every 2s"
https://htmx.org/docs/#polling

Maybe Svelte has an easier way, but Google isn't directing me straight to it, which is all part of the "easy to learn" aspect.

Post reply on HN