htmx interview question · Most asked
What changed in htmx 4?
Summary
htmx 4.0 (August 2026) switched from XMLHttpRequest to fetch() with streaming, made inheritance explicit (:inherited), swaps 4xx/5xx responses by default (except 204/304) with hx-status for control, renamed events to htmx:phase:action (htmx:after:request), renamed hx-disable to hx-ignore and hx-disabled-elt to hx-disable, removed history snapshots in storage, and added a 60-second default timeout and morph swaps.
Longer Answer
htmx 2 remains supported indefinitely and stays npm's latest until some point in early 2027, so upgrading is optional. The official upgrade checker (npx [email protected] upgrade-check) finds the attributes and events to change. Extensions are now loaded with a script tag, without hx-ext.
Key Points
- fetch() and streaming.
- Explicit inheritance.
- Error responses swapped; hx-status.
- Renamed events and attributes.
Deep dive: htmx Tutorial: Upgrading to htmx 4
More most-asked htmx questions
- How do you handle form validation errors with htmx?
- How does htmx compare with React or Vue?
- What is htmx?
- What do hx-get, hx-post, hx-put, hx-patch and hx-delete do, and how are values sent?
- What is hx-target, and what relative selectors does it support?
- What swap styles does hx-swap support?
- How does hx-trigger work? Give examples of modifiers and special triggers.
- What security risks are specific to htmx, and how do you mitigate them?