logoalt Hacker News

rkomornlast Thursday at 3:23 PM3 repliesview on HN

> it is a small js library ... This means that in theory you don't need js

I assume I'm not the only person left a little puzzled.

Do you mean "don't need JS" as in like, a full-fledged JS framework?


Replies

ndrlast Thursday at 3:31 PM

See the quickstart from htmx.org

    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/htmx.min.js"></script>
      <!-- have a button POST a click via AJAX -->
      <button hx-post="/clicked" hx-swap="outerHTML">
        Click Me
      </button>

When the user clicks the button the browser will take the result of the request to `/clicked` and swap the whole button dom node for whatever the server sent.

As a dev you get to write HTML, and need to learn about some new tag attributes.

Your browser is still running js.

lunar_mycroftlast Thursday at 3:31 PM

They mean that you don't need to write JS, you can just add a script tag to your page

chamomeallast Thursday at 4:40 PM

Sorry I know other people have responded already, but it means you don't have to write any client side javascript at all. You can just skip along with a server that returns html. Just throw the script tag in there, and you're done.

The magic of this is that it's pretty easy to make SPA-like webapps with no javascript or complex client side framework. You can write your server in python, rust, clojure, whatever. If you don't need a lot of state management, it's really simple and awesome.