Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Why not just write the js yourself? It's really not that complicated. The people who keep pushing for htmx are weird.

HTMX is great. We use it as a middle ground for mildly interactive parts of the app. Places where jquery/vanilla would get annoying but going full React isn’t worth it. Admin interfaces in particular are a great fit – lots of CRUD, mildly interactive, very repetitive.

Adding `hx-get` to a button or div is way way quicker than writing all that boilerplate javascript yet again for the hundredth time.

Extra bonus: it encourages you to write small self-contained composable endpoints instead of massive kitchen-sink pages.



> Admin interfaces in particular are a great fit – lots of CRUD, mildly interactive, very repetitive. Adding `hx-get` to a button or div is way way quicker than writing all that boilerplate javascript yet again for the hundredth time.

Yes. Then imagine you have a massive legacy codebase and a control panel of something has a ton of data and buttons and inputs and all kinds of nonsense. Say you have a weight and dimensions of a package of a product... you'd like to make it so you can edit these in-place and when you do, a package volume (and/or volume sum of all packages) gets updated somewhere else on the page (along with some other info... I don't know, an estimate of product delivery cost based on volume, which delivery methods are now un/available etc.)

Like... you already have ways to calculate and show these in your server side logic. With HTMX you reuse these, add a sprinkle of hx-get and add some OOB updates and you're done. You can do the same with ajax, but not nearly as fast as with HTMX and much more annoyingly...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: