Misago项目正筹划将前端框架从React.js迁移至Htmx,以解决现有架构中的多项设计问题。[1]当前系统采用Django视图渲染HTML后再由JavaScript下载React组件替换页面大部分内容的方式,[1]但这种架构导致页面逻辑需要在Django模板和React组件中分别实现,翻译文件也重复存储在django.po和djangojs.po两处,[1]同时大量JavaScript代码对老旧移动设备性能造成负面影响。[1]
Htmx是一个声明式库,允许指定HTML部分为动态区域,通过服务端渲染的HTML交换实现交互。[1]提议中的Htmx方案无需复杂的前端框架和专用API层,[1]其核心优势在于消除了JSON序列化的开销、避免了专用JavaScript代码的编写,后端仅需返回必要的HTML片段而非完整页面,[1]从而显著简化开发流程并改善系统性能。
The Misago project is planning to migrate from React.js to Htmx for handling user interface interactions [1]. This transition addresses multiple inefficiencies in the current architecture, where Django views render HTML and JSON that is then largely replaced by React components downloaded to the client [1].
The existing architecture creates substantial maintenance burden and performance challenges [1]. Page logic must be implemented twice—once in Django templates and again in React components—while translation files are duplicated across django.po and djangojs.po files [1]. Additionally, the heavy JavaScript footprint degrades performance on older mobile devices [1], and JSON serialization introduces latency in response times [1].
Htmx offers a declarative alternative to address these issues [1]. The library allows developers to designate specific HTML sections as dynamic islands, which are updated through server-rendered HTML fragments [1]. By adopting Htmx, the backend delivers only the necessary HTML segments rather than complete pages, eliminating the need for JSON serialization or dedicated frontend JavaScript code [1].