TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Htmx Is Composable?

85 pointsby tkelloggover 1 year ago

13 comments

BiteCode_devover 1 year ago
HTMX is neutral to composability, since it&#x27;s limited to connecting and orchestrating parts of a system that may or may not chose to provide components.<p>Does your backend has components? Does your scripting toolkit has components?<p>HTMX doesn&#x27;t care either way, and will use whatever you give it.<p>You can pick reusable django forms, alpine js, some manually created boundaries, a jquery module... You can even drop react on a single page because there is a widget you like and it&#x27;s not loaded often.<p>People may be tempted to talk about HTMX using irrelevant points of references.<p>It&#x27;s not providing an SPA with a component architecture, that&#x27;s the point.<p>The readers that are very used to modern JS stacks and never had to deal with the web before 2010 may want to read:<p><a href="https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;a-little-taste-of-htmx-part-1" rel="nofollow">https:&#x2F;&#x2F;www.bitecode.dev&#x2F;p&#x2F;a-little-taste-of-htmx-part-1</a><p>This will give a better idea of how to think in HTMX, which is just a new trick for an old dog.<p>It&#x27;s better to use this tool for what it is, with its limits and strengths rather than trying to make it into something it&#x27;s not.<p>The reason HTMX can&#x27;t do many things react is good at is because it&#x27;s by nature the opposite of react.
lucasyvasover 1 year ago
One thing I see lacking with HTMX is that, eventually, someone will want to package and distribute a third party component. You say &quot;but it&#x27;s meant for small things not requiring much scripting&quot; and I say &quot;I don&#x27;t believe you - once it&#x27;s in it will grow indefinitely&quot;.<p>This is definitely possible, but unless you are using WASM or something you would have component libraries specifically built for a backend language or framework which doesn&#x27;t leave us much better off.<p>To be fair, I have not seen this stated as a goal or concern of HTMX anywhere. But, it&#x27;s a concern of mine - I&#x27;m not going to build all my components from scratch all the time and this kills HTMX for me.<p>I guess what this would look like is an encapsulated backend module with internal templating and properties that allow controlling certain behaviours or routes. Definitely doable, not thought out at all.
评论 #39029283 未加载
评论 #39029056 未加载
评论 #39029917 未加载
评论 #39029067 未加载
wg0over 1 year ago
I am confused about htmx because if it is about AJAX, they don&#x27;t replace the window URL as user clicks about and around unless you explicitly tell HTMX to do so.<p>And if you step into that realm of keeping the window URL in sync with where exactly the user is in the app, then you&#x27;re almost already into realm of SPAs but without having the full set of tools that go with SPA.<p>Any open source project done in HTMX that has gone beyond TODO&#x2F;LLM front ends etc could be interesting to look at
评论 #39030736 未加载
评论 #39028806 未加载
评论 #39029044 未加载
评论 #39028612 未加载
评论 #39028788 未加载
评论 #39056676 未加载
评论 #39029098 未加载
评论 #39030207 未加载
SideburnsOfDoomover 1 year ago
&gt; Years ago, in .NET and Java, it was popular to use an Inversion of Control container with XML configuration that declared and configured different classes and objects. I think it largely went out of style because it’s complicated, or at least more complicated than it needed to be.<p>In .NET anyway, this was replaced by use an Inversion of Control container with configuration as code. Because it&#x27;s more flexible if you need that. And if you don&#x27;t, it&#x27;s just a boring (in the good sense) list of e.g.:<p>services.AddTransient&lt;IFoo, FooService&gt;();<p>services.AddScoped&lt;IBar, BarService&gt;();<p>services.AddSingleton&lt;SomeType&gt;();<p>&#x2F;&#x2F; etc for many lines<p>This is definitely no worse than XML.<p>It&#x27;s now as simple or as complicated as you want it to be. Using the same tools as the rest of the app code rather than a different syntax.
评论 #39027975 未加载
larveover 1 year ago
I&#x27;m not sure I fully understand the composable part. To me this seems like server-side rendered HTML on the one end (which indeed makes it easier to debug), and a react version on the other end. React would instead of passing the object directly to the renderer (as one can do when doing it all in one process), have some fetching mechanism.<p>In terms of composability, react seems more composable to me. I can delegate the distributed and state aspect to something like redux &#x2F; redux query, and fully concentrate on the composable component system. The added benefit is of course to separate backend and frontend concerns, which might or might not be to your like or useful within a certain project&#x27;s scope.
评论 #39028334 未加载
评论 #39028669 未加载
kugelblitzover 1 year ago
Oof, 4.5 MB for a decorative image.
评论 #39028449 未加载
评论 #39028683 未加载
jddjover 1 year ago
This reminded me that one thing I miss from WPF is the &quot;free&quot; render-time polymorphism.<p>If you had an interface, say ICard, and a few xaml data templates for how to render the concrete types, all you had to do was bind to a collection of ICards and it would automatically do what I guess we&#x27;d now call pattern matching on the concrete type of each element to render it without needing to mix the presentation with the plain old c# objects.
评论 #39028328 未加载
betenoireover 1 year ago
Something about this feels really at odds with all the &quot;locality of behavior&quot; virtue the creator&#x2F;maintainer often promotes.
评论 #39029613 未加载
maxpertover 1 year ago
For the folks who have been writing these inline HTML views and been wishing to have a more composable way of generating HTMX like in this blogpost try <a href="https:&#x2F;&#x2F;github.com&#x2F;maxpert&#x2F;htmxido">https:&#x2F;&#x2F;github.com&#x2F;maxpert&#x2F;htmxido</a>
daxfohlover 1 year ago
I couldn&#x27;t get it to work with single-spa, which is what our company&#x27;s UI framework uses to compose components built by different teams.<p>It seems like the two approaches are at odds with each other anyway, so perhaps this won&#x27;t ever be possible.
nsonhaover 1 year ago
&gt; HTMX as Configuration<p>Bam, there you are, can&#x27;t make programs with just configuration, that&#x27;s a wet dream.<p>The article also mentions IoC configuration, which is a horrible way to program, another thing that is only good on paper.
Terrettaover 1 year ago
Feedback to author:<p>The diagram and explanation took a beat longer than normal to scan, since this buries a bit that it&#x27;s not about the beautiful source control system called fossil shipped as a composition of modules:<p><a href="https:&#x2F;&#x2F;fossil-scm.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;index.wiki" rel="nofollow">https:&#x2F;&#x2F;fossil-scm.org&#x2F;home&#x2F;doc&#x2F;trunk&#x2F;www&#x2F;index.wiki</a><p>Great diagrams, so of course that&#x27;s the first thing a reader will skim. Reader thinks people build things based on git all the time, the diagram looks like it&#x27;s based on fossil, cool, scan more...<p>Making it take a bit longer when scanning upwards from the diagram, the Mastodon client is introduced without naming it until an aside at the end of the paragraph:<p>&gt; <i>Before the New Year I decided to hack on an idea. I wanted a social media client for Mastodon that displays my feed in a way that suits me ... I call it Fossil.</i><p>If you missed that at the end and scan back down to the arch section, it mentions fossil without really saying it&#x27;s the social media app:<p>&gt; <i>With fossil plugins, it’s become straightforward to work on any part of the stack:</i><p><i>- UI elements — write verbatim HTML or Jinja templates, packaged into a plugin</i><p><i>- API endpoints — register them via a decorator API</i><p><i>- DB tables — Create them during plugin initialization</i><p><i>- AI algorithms — register them via the API</i><p><i>- fossil</i><p>&gt; <i>That’s neat. The whole stack.</i><p>I&#x27;d edit three things:<p>+ &quot;...social media client for Mastodon I call ‘Fossil’ that displays my feed...&quot;<p>+ &quot;With plugins for my Fossil app...&quot;<p>+ &quot;- fossil mobile app&quot;
chupapimunyenyoover 1 year ago
The author of the article needs to read this <a href="https:&#x2F;&#x2F;youryoure.com&#x2F;?its" rel="nofollow">https:&#x2F;&#x2F;youryoure.com&#x2F;?its</a>
评论 #39028184 未加载
评论 #39028246 未加载