Comment

Comment by TekMol

Hmmmm... no.

This:

    <button hx-post="/clicked" hx-swap="outerHTML">
        Click Me
    </button>
Should be just this:

    <button onclick="htmx.post('/clicked', 'outerHTML')">
        Click Me
    </button>
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.
parent TekMol 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton