HTMX & Go

HTMX & Go Introduction

Topics:
Check out a free preview of the full HTMX & Go course:
The "Introduction" Lesson is part of the full, HTMX & Go course featured in this preview video. Here's what you'd learn in this lesson:

ThePrimeagen introduces HTMX and shares personal experiences in the web programming world, reflecting on the evolution of technologies like jQuery and React. They express discontent with certain aspects of modern web development and explain why they find HTMX appealing for its simplicity and ease of use. The lesson covers various topics, including some history of hypermedia, the speaker's journey in web development, and their reasons for favoring HTMX.

Get Unlimited Access Now

Transcript from the "Introduction" Lesson

[00:00:00]
>> This is unironically the intro that I have chosen, which is this beautiful post by htmx or actually just the banner, which he tends to take pictures of things people positively say on Reddit, and then make them his banner. So this one says, the creator of htmx is a blowhard who found fertile ground for his broken library in the minds of back-end devs that refuse to learn JavaScript for reasons that are 20 years out of date.

[00:00:25] It's propaganda being spread by propagandists, ignore them all, and they'll go away. I am a propagandist being paid by big HTML money, very excited about this. I don't know what it is about the world of HTMX, but for whatever reason, it has just the bizarrest, either lovers or haters of it.

[00:00:46] There is just zero middle ground for this library. I recently saw a tweet saying someone says that they're very convinced that there's influence or money behind HTMX. I don't know what that means yet, I would love to know more about this influencer. But if anyone would like to send me some, please Twitch, Prime are always accepted around here.

[00:01:06] All right, so there you go, this beautiful thing and, yes, this was literally my introduction. You're welcome, but hypermedia has been around for a long time. There's been papers, engineering exercises long before the Internet had such a wide pipe that, I mean, even in 1995, there was discussions in white papers about how to use this as an engine of application state.

[00:01:26] So this is a fairly older and more researched topic. It's not just some new library that recently came out, it's been going on now for dang near 30 years. So hopefully, everyone's kind of excited about that. All right, so there is more to HTMX than just the memes.

[00:01:42] Yes, they use their Twitter quite a bit to deliver all the sweet memes, but really it's just so people can learn about HTMX, it's a great marketing strategy. You would think that it's a whole team of people doing something, spreading the word since it's going all over the place.

[00:01:55] And yes, it's now on Frontend Masters, but, no, it's just one slightly unhinged man in Montana tweeting from his professorship. Nobody knows what's happening, and it's actually is used in production. There is a nice, beautiful talk about somebody how they went from React to HTMX reduced a huge number of their libraries, how fast they're able to build the project, there's a list of sites that use it.

[00:02:18] I have people that have reached out to me that have converted their big projects from SPAs into HTMX, several of them with lots of lots of engineers, and they found that they are now moving faster, it's easier to reason about. And I do think that there's not like every single application should be written in HTMX.

[00:02:32] And I think there's actually a good deal of applications that probably are easier or harder with client-side state management, I just really don't know. But I do think that there is a sweet spot for HTMX, and so at the end of this course I will try to give you what I think is the goods place, what's the bad place, and hopefully, you can do that too.

[00:02:48] So why do I like HTMX? Well, it's kind of a long story, but in about, what, 2009, that movie, the social media one, what's it called? Does anyone remember what it's called?
>> The Social Awkward.
>> The Social Awkward, yeah, that's what it's called. Where Mark Zuckerberg discovers Facebook, and that he discovers people really like to know who's dating who, and that's like the point of the story, and it blows up and all these things happen.

[00:03:13] And I remember watching that show and getting so pumped up to create my own website and all that. Even though, I was in college and all that, I was like gee, dang it, we're gonna do this. And so that's what I did, I sat down and for 80 hours a week, I tried to learn how to make websites for, gosh, four years straight, something like that.

[00:03:33] And it was fantastic, I made websites, tried to do all these things, lost all my money, lived in a small studio apartment where the man below me smoked meth, and threatened to kill me, and my beautiful wife, so we eventually moved out of there. Fantastic times, but that was the introduction into the web programming world that I had.

[00:03:51] And through that, I got to see a whole bunch of change, right? I started before jQuery was super popular, and then during the height of jQuery, where you'd even do your math via jQuery, you know that whole jQuery dollar sign three dot add for, it was really really beautiful.

[00:04:08] Those are the good days, and so that was the height of it, you can see all the Stack Overflow questions, that every last one was answered with jQuery no matter what it was, fantastic. And then React came out, and at that point I was working at Netflix. By the way I work at Netflix and during that time, I remember thinking this is the coolest thing ever, because I've been using jQuery, and all this stuff to manage my website for so long.

[00:04:31] And now, there's like something that feels better, it feels more exciting, and I couldn't believe how cool it was. And so we started doing that, and even at Netflix, we started adopting it, even for television platform, and it took us a long time. And during that process, it went from classes are the best to classes are the worst.

[00:04:49] We had functional component use effect, don't use effect, and just kept on changing, and kept on happening over the course of the eight years. And in there, I tried to solve a lot of the data fetching problems that people run into with SPAs. And they're rerunning into and rediscovering the glories of the N+1 query problem in RSCs right now.

[00:05:06] And so it's just like you watch all these things happen, and you realize that maybe something went wrong along the way. Maybe things weren't exactly what I thought they were. And I started becoming disenfranchised about six years ago, and I just became progressively more. And I've just been looking around trying to find something that is maybe less foot gunning, something that less causes so many easy problems.

[00:05:30] And, yeah, there will always be the website that needs these high powered engines, but for the most part, for all of us, they're just making our nice little reel of cat photos on the Internet. You just don't need necessarily the largest possible state. I think of the, I don't know if you guys watched the One Piece live action, but when the greatest swordsman fight ever happens, and he pulls out the little teeny tiny sword, the answer was you just don't hunt fish with a cannon.

[00:05:55] And it's just like, yeah, sometimes you just gotta get the little sword out, you don't have to have the big one, and so I just absolutely love that part. And so that's kind of HTMX, that's kind of why I love it is that it kind of fit this weird place that I've been looking for, which is I just need something that I can reason about in a more engineering sense about how something moves over time, cuz that's ultimately what I'd like.

[00:06:13] HTMX is extremely Googleable, if you happen to know what you're looking for, if you know the terms, it's extremely Googleable. I'll show you, if I go like this, htmx select, it's gonna come up as one of the first things of how you do a thing. So hx-select, it's gonna give you all the notes for it, it's very, very easy to learn how to use this, everything is extremely lookupable.

[00:06:36] And I helped build the LSP, which is pretty nice, it really only works with Neovim right now. I'm sure someone, I know it kind of has a VS Code integration, it's not on Mason or anything, but it's all kind of there, it's pretty nice. There's a great book, the book is really great, it's free digitally, so go use it.

[00:06:53] You can also get HTMX coffee mugs that exclaim that you are a HTMX shill, very good with influencer money. So fantastic stuff out there.