Interview Q&A · questions with model answers
htmx Interview Questions
Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.
-
Most asked How does htmx compare with React or Vue?
React and Vue usually render HTML in the browser from JSON returned by an API, with state in JavaScript. htmx renders on the server and swaps HTML fragments, with state on the server. htmx means…
-
Most asked Which request headers does htmx send, and how are they used?
HX-Request: true on every htmx request; HX-Trigger (id of the triggered element), HX-Trigger-Name, HX-Target (target id), HX-Current-URL, HX-Boosted for boosted requests, HX-Prompt for hx-prompt…
-
Most asked When would you not choose htmx?
When the UI changes constantly without the server (drawing tools, spreadsheets, drag-and-drop editors, games), must work offline, or must share a JSON API with mobile apps and the team is already…
-
What is the difference between delay and throttle in hx-trigger?
delay:500ms is a debounce: each new event restarts the timer, and the request is sent once events stop for 500 ms. throttle:500ms sends at most one request per 500 ms while events keep arriving.
-
Which response headers can an htmx server send?
HX-Trigger (fire events), HX-Redirect (full redirect), HX-Location (htmx-style navigation), HX-Refresh (reload), HX-Push-Url and HX-Replace-Url (change the URL), HX-Retarget (change the target),…
-
What is hx-on, and when should you use it?
hx-on:<event>="code" runs inline JavaScript when an event fires, for example hx-on:click or hx-on::after-request (shorthand for htmx:after-request). Use it for small, local behaviours such as…
-
What is the difference between hx-push-url and hx-replace-url?
hx-push-url adds a new browser history entry with the request URL (or a given path), so Back returns to the previous state. hx-replace-url changes the URL in place without a new entry, which suits…
-
What is the difference between hx-disable and hx-disabled-elt in htmx 2?
hx-disable turns off htmx processing for an element and its descendants (a security tool for user content). hx-disabled-elt adds the disabled attribute to elements while a request is in flight (a UX…