Recently, Rich Harris, creator of the Svelte framework, released a video asking if single-page apps have ruined the web? In the video, Harris examines the pros and cons of both sides, eventually determining that the way forward is to use a bit of both approaches — via what he calls “transitional apps,” which are a mix of both SPA and MPA technologies.
In a response to this video, Carson Gross, creator of htmx, argued that most of the specific examples Harris offers as problematic for MPAs are actually solvable with htmx itself. Beyond offering htmx as the solution, however, Gross also argues that there’s one big issue that Harris overlooked in his examination of the cons of SPAs: complexity.
What Is htmx and Why Is It Useful?
Complexity in frontend web development is something that Gross has been attempting to address for nearly a decade now, having first created the intercooler.js alternative frontend library back in 2013, which came with the tagline “AJAX With Attributes: There is no need to be complex”. Recently, intercooler.js hit version 2.0 and became htmx, which the GithHub description says “allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext”.
“The concept is, let’s use the original model of the web for building web apps, but let’s make HTML more powerful.”
– Carson Gross, creator of htmx
- Why should only <a> and <form> be able to make HTTP requests?
- Why should only click & submit events trigger them?
- Why should only GET & POST methods be available?
- Why should you only be able to replace the entire screen?
Make HTML More Powerful
Gross sees htmx as an answer to this complexity for many websites out there — even sites like Facebook or Twitter, which are “mostly text and pictures”.