Hacker News new | ask | show | jobs
by mmarian 742 days ago
> <div hx-get="/poll_content_chunks?last_chunk_id={{chunk_id}}&session_id={{session_id}}&type={{chunk_type}}" hx-trigger="every 5s once" hx-swap="outerHTML settle:1s">

I'll probably be downvoted but this code shows why I'm put off by htmx. The belief that just because you write the least amount of code, it always means that it's the simplest solution. To me, that's a lot harder to understand than if I used React. Having tried both, I found the learning curve pretty much the same.

1 comments

The difference, is that with HTMX, the above line and the HTMX JavaScript file is all you need. There is no separate build systems, or mess of dependencies, or anything like that. You just link to the HTMX JS file, and you're away. I think it's fair to say the HTMX learning curve is significantly different to React.
> no separate build systems, or mess of dependencies

Why is that necessarily a bad thing? Django's build system is atrocious too; eg there's no consensus around what web server you should use https://docs.djangoproject.com/en/5.0/howto/deployment/. Yet that doesn't prevent you from using the framework.

> I think it's fair to say the HTMX learning curve is significantly

Agree to disagree I'm afraid. It's not just the fact that you have to learn HTMX, but also how to work with SSR.

And of course, I got downvoted :). Which is a shame because it discourages me from spending time explaining an alternative view in the hopes that I could help.

Do you wanna upvotes here? Better think about how to convince people that having a server serving every request is good. It's impossible to do that without some strong Steve Jobs reality distortion field. Well I can empathize with them, think about how tedious it is to work for big techs without refactoring useless products with the useless new framework
HTMX doesn't require Django - you can use it with any web framework you like. And server side rendering should be fundamental knowledge that anybody working in the web-space should understand.
> HTMX doesn't require Django - you can use it with any web framework you like

I agree, but that wasn't the point I was making. My point was to question why a simpler build system should be the deciding factor for your tech stack. You could've used Go for your backend if that was the case. But you chose Django because it offers an ecosystem of tools. So does React.

> server side rendering should be fundamental knowledge that anybody working in the web-space should understand.

I'd invite you to question why that's the case. This "X should know Y even if few actually use it" type of thinking is very prevalent in the developer community.

I'm really not sure why you keep comparing React to Django? My original point was that HTMX is easier to learn than React.

As for your second point, I think I must be missing something or misunderstanding where you're coming from. It seems fairly fundamental that developers should understand that web servers can render web pages. Even the JSON files that flow into React applications are rendered on a server and served with a web server.

You know that JavaScript doesn't need a build system right? But htmx will always need a build and a running server.