ClojureScript Frontend: Beyond the SPA Debate
In the recent discussions surrounding frontend technologies, there has been a lot of focus on HTMX and its perceived advantages over ClojureScript (CLJS) frontends. However, it is important to note that CLJS is not limited to building complex single-page applications (SPAs) with server-side rendering (SSR). In fact, CLJS offers a range of techniques that are often overlooked in these debates.
While SPAs with SSR can be challenging, CLJS provides a simpler alternative. One such technique is using Hiccup for the backend, which has been a popular choice for many developers for over a decade. Hiccup offers a straightforward approach to building frontends without the need for complex SSR with frameworks like React.
It is worth mentioning that HTMX, while not inherently bad, is not a groundbreaking concept. Similar approaches have been used in web development for the past 20+ years, with libraries like jQuery being prime examples. However, the scalability of such libraries becomes an issue when additional or different functionality is required. This often leads to workarounds or reliance on build tools, which may contradict the initial goal of simplicity.
Instead of getting caught up in the SPA vs. HTMX debate, developers should focus on the concept of annotating the DOM, which has been a fundamental technique in web development since the introduction of JavaScript. This approach, sometimes referred to as Progressive Web Apps (PWAs), allows for a more flexible and lightweight frontend development experience without the need for unnecessary complexities like Service Workers.
In conclusion, it is essential for developers to explore the full potential of CLJS beyond the SPA paradigm. By leveraging techniques like Hiccup and embracing the concept of annotating the DOM, developers can build lighter and more adaptable frontends. Let's not overlook the lost arts of CLJS frontend development and continue to push the boundaries of what can be achieved with this powerful language.