htmx interview question · Most asked
What does 'hypermedia-driven application' mean?
Summary
An application where the server answers with hypermedia (HTML that includes the next possible actions as links, forms and htmx attributes) instead of raw data. The client doesn't need to know the application's rules; it renders what the server sends and follows the controls in it.
Longer Answer
This is how the original web worked, and it's the architecture REST was describing (hypermedia as the engine of application state). Single-page apps instead use JSON APIs and put rendering and much of the logic in the browser. htmx extends HTML's hypermedia controls so a hypermedia-driven app can be as interactive as most SPAs, while keeping state and rendering on the server.
Key Points
- Server sends HTML with the available actions.
- Client renders and follows controls.
- Logic and state stay on the server.
- htmx makes hypermedia more capable.
Deep dive: htmx: Build Interactive Web Apps with HTML: Why htmx? Hypermedia vs JSON APIs
More most-asked htmx questions
- 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.
- How do you handle form validation errors with htmx?
- What security risks are specific to htmx, and how do you mitigate them?