htmx in 100 seconds

Fireship · Beginner ·🌐 Frontend Engineering ·3y ago

Key Takeaways

The video demonstrates the basics of htmx, an HTML-focused UI library that can handle data fetching and rendering in web applications without complex JavaScript code or frameworks, and showcases its features and usage.

Full Transcript

htmx a UI library for the web that can replace your JavaScript framework with the Simplicity of HTML playing HTML is more capable than you think every time you click on a link or submit a form it automatically sends an HTTP request to the server and renders the response in the UI it's so easy but why stop there HDMX Embraces an architectural constraint known as Hyper media as the engine of application state by adding new attributes to HTML that can handle the complex requirements of modern uis it gives you the ability to make a request to the server from any element by providing an attribute with an HTTP verb and the URL endpoint on the server it'll take the response from the server and replace this element asynchronously or it can specify a Target to replace a different element on the page it can also customize the event on which it's triggered along with modifiers like delay and throttle to control the way the request is sent it keeps track of the loading state so you can show a spinner apply CSS transitions for animation and builds on the HTML validation API to validate forms it even has a client-side router called boost that can make any traditional web application feel like a faster single page application and it also includes extensions for more advanced features like websockets and Integrations with other HTML Frameworks like Alpine to install it simply Import htmx in a script tag from the head of an HTML document you just put the hyper back into hypertext now all you need is a server in your favorite programming language that returns html text as a response now we can use the HX get attribute to make a request to this endpoint along with HX swap to replace this element with the HTML on the response when swapping though we don't only have the option to replace the outer HTML but we could also append or prepend the response to the existing UI or the HX Target attribute allows us to move the UI to a completely different element it finds that element with a CSS selector but has additional syntax like next and closest allowing you to easily find the proper element without a bunch of custom IDs we might also use HDMX indicator to show a loading spinner and write a CSS transition animation for the incoming element behind the scenes a HDMX has an extensive event system that you can tap into by listening to custom events with JavaScript and if you want to run your own client-side JavaScript the HX on attribute allows you to bind a JavaScript function to any element and that's all it takes to build a highly polished full stack HTML application on the information superhighway this has been htmx in 100 seconds do you love it or do you hate it let me know in the comments thanks for watching and I will see you in the next one

Original Description

Learn the basics of htmx - an HTML-focused UI library that can handle data fetching and rendering in web applications without complex JavaScript code or frameworks. #webdevelopment #javascript #100SecondsOfCode 💬 Chat with Me on Discord https://discord.gg/fireship 🔗 Resources - htmx docs https://htmx.org - HTML in 100 seconds https://youtu.be/ok-plXXHlWw - Nuxt in 100 Seconds https://youtu.be/dCxSsr5xuL8 - Math for Programmers https://youtu.be/lkIFF4maKMU 🔥 Get More Content - Upgrade to PRO Upgrade at https://fireship.io/pro Use code YT25 for 25% off PRO access 🎨 My Editor Settings - Atom One Dark - vscode-icons - Fira Code Font 🔖 Topics Covered - What is htmx? - htmx quickstart tutorial - Alpine.js vs htmx - Do I need a JavaScript framework? - What is AJAX in web development? - htmx boost vs Turbolinks
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Fireship · Fireship · 0 of 60

← Previous Next →
1 Angular 4 Development and Production Environments with Firebase
Angular 4 Development and Production Environments with Firebase
Fireship
2 OAuth with Angular and Firebase Tutorial
OAuth with Angular and Firebase Tutorial
Fireship
3 Anonymous Authentication with Angular and Firebase - Lazy Registration
Anonymous Authentication with Angular and Firebase - Lazy Registration
Fireship
4 Angular Router Guards for Firebase Users
Angular Router Guards for Firebase Users
Fireship
5 Angular Firebase CRUD App with NoSQL Database Tutorial
Angular Firebase CRUD App with NoSQL Database Tutorial
Fireship
6 Upload Files from Angular to Firebase Storage
Upload Files from Angular to Firebase Storage
Fireship
7 How to Deploy an Angular App to Firebase Hosting
How to Deploy an Angular App to Firebase Hosting
Fireship
8 Sharing Data between Components in Angular
Sharing Data between Components in Angular
Fireship
9 Loading Spinners for Asynchronous Firebase Data
Loading Spinners for Asynchronous Firebase Data
Fireship
10 Angular 4 Transactional Email with Google Firebase Cloud Functions
Angular 4 Transactional Email with Google Firebase Cloud Functions
Fireship
11 Firebase Database Rules Tutorial
Firebase Database Rules Tutorial
Fireship
12 Autocomplete Search with Angular4 and Firebase
Autocomplete Search with Angular4 and Firebase
Fireship
13 Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Fireship
14 Angular Drag-and-Drop File Uploads to Firebase Storage
Angular Drag-and-Drop File Uploads to Firebase Storage
Fireship
15 Text Translation with Firebase Cloud Functions onWrite and Angular 4
Text Translation with Firebase Cloud Functions onWrite and Angular 4
Fireship
16 Custom Usernames with Firebase Authentication
Custom Usernames with Firebase Authentication
Fireship
17 Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Fireship
18 Simple Pagination with Firebase and Angular 4
Simple Pagination with Firebase and Angular 4
Fireship
19 How to Connect Firebase Users to their Data - 3 Methods
How to Connect Firebase Users to their Data - 3 Methods
Fireship
20 Add Toast Message Notifications to your Angular App
Add Toast Message Notifications to your Angular App
Fireship
21 Facebook-Inspired Reactions System with Angular and Firebase
Facebook-Inspired Reactions System with Angular and Firebase
Fireship
22 Learn NgModule in Angular with Examples
Learn NgModule in Angular with Examples
Fireship
23 Lazy Loading Components in Angular 4
Lazy Loading Components in Angular 4
Fireship
24 Stripe Checkout Payments with Angular and Firebase - Part 1
Stripe Checkout Payments with Angular and Firebase - Part 1
Fireship
25 Process Stripe Payments with Firebase Cloud Functions - Part 2
Process Stripe Payments with Firebase Cloud Functions - Part 2
Fireship
26 Selling Digital Content in Angular with Stripe Payments - Part 3
Selling Digital Content in Angular with Stripe Payments - Part 3
Fireship
27 Angular 4 Full Text Search with Algolia - Part 1
Angular 4 Full Text Search with Algolia - Part 1
Fireship
28 Algolia with Firebase Cloud Functions - Part 2
Algolia with Firebase Cloud Functions - Part 2
Fireship
29 Firebase Phone Authentication in Angular 4
Firebase Phone Authentication in Angular 4
Fireship
30 Top 7 RxJS Concepts for Angular Developers
Top 7 RxJS Concepts for Angular Developers
Fireship
31 Learn Angular Animations with 5 Examples
Learn Angular Animations with 5 Examples
Fireship
32 Advanced Firebase Data Filtering (Multi-Property)
Advanced Firebase Data Filtering (Multi-Property)
Fireship
33 Realtime Maps with Mapbox + Firebase + Angular
Realtime Maps with Mapbox + Firebase + Angular
Fireship
34 Angular Reactive Forms with Firebase Database Backend
Angular Reactive Forms with Firebase Database Backend
Fireship
35 Send Push Notifications in Angular with Firebase Cloud Messaging
Send Push Notifications in Angular with Firebase Cloud Messaging
Fireship
36 Top 7 Ways to Debug Angular 4 Apps
Top 7 Ways to Debug Angular 4 Apps
Fireship
37 Infinite Scroll with Angular and Firebase
Infinite Scroll with Angular and Firebase
Fireship
38 Use TypeScript with Firebase Cloud Functions
Use TypeScript with Firebase Cloud Functions
Fireship
39 Realtime Graphs and Charts with Plotly and Firebase
Realtime Graphs and Charts with Plotly and Firebase
Fireship
40 Role-Based User Permissions in Firebase
Role-Based User Permissions in Firebase
Fireship
41 User Presence System in Realtime - Online, Offline, Away
User Presence System in Realtime - Online, Offline, Away
Fireship
42 Location-based Queries with GeoFire and Angular Google Maps
Location-based Queries with GeoFire and Angular Google Maps
Fireship
43 Angular ngrx Redux Quick Start Tutorial
Angular ngrx Redux Quick Start Tutorial
Fireship
44 Angular Ngrx Effects with Firebase Database
Angular Ngrx Effects with Firebase Database
Fireship
45 Progressive Web Apps with Angular
Progressive Web Apps with Angular
Fireship
46 Angular Ngrx with Firebase Google OAuth User Authentication
Angular Ngrx with Firebase Google OAuth User Authentication
Fireship
47 RxJS Quick Start with Practical Examples
RxJS Quick Start with Practical Examples
Fireship
48 Send SMS Text Messages with Twilio and Firebase
Send SMS Text Messages with Twilio and Firebase
Fireship
49 Firebase Database Performance Profiling
Firebase Database Performance Profiling
Fireship
50 Native Desktop Apps with Angular and Electron
Native Desktop Apps with Angular and Electron
Fireship
51 Subscription Payments with Stripe, Angular, and Firebase
Subscription Payments with Stripe, Angular, and Firebase
Fireship
52 Firestore with AngularFire5 Quick Start Tutorial
Firestore with AngularFire5 Quick Start Tutorial
Fireship
53 Angular HTTP Client Quick Start Tutorial
Angular HTTP Client Quick Start Tutorial
Fireship
54 Google Sign-In with Firestore Custom User Data
Google Sign-In with Firestore Custom User Data
Fireship
55 Star Review System from Scratch with Firestore + Angular
Star Review System from Scratch with Firestore + Angular
Fireship
56 Angular Chatbot with Dialogflow (API.ai)
Angular Chatbot with Dialogflow (API.ai)
Fireship
57 Learn @ngrx/entity and Feature Modules
Learn @ngrx/entity and Feature Modules
Fireship
58 Infinite Scroll Pagination with Firestore
Infinite Scroll Pagination with Firestore
Fireship
59 Faster Firestore via Data Aggregation
Faster Firestore via Data Aggregation
Fireship
60 Contentful - CMS for Angular Progressive Web Apps
Contentful - CMS for Angular Progressive Web Apps
Fireship

The video introduces htmx, a UI library that simplifies web development by handling data fetching and rendering with HTML, and demonstrates its features and usage. htmx provides a range of attributes and tools to build highly polished full-stack HTML applications. By using htmx, developers can create web applications without complex JavaScript code or frameworks.

Key Takeaways
  1. Import htmx in a script tag from the head of an HTML document
  2. Use the HX get attribute to make a request to a server endpoint
  3. Use the HX swap attribute to replace an element with the HTML response
  4. Use the HX target attribute to specify a target element to replace
  5. Customize the event on which the request is triggered with modifiers like delay and throttle
  6. Show a loading spinner using the HX indicator attribute
  7. Write a CSS transition animation for the incoming element
  8. Bind a JavaScript function to an element using the HX on attribute
💡 htmx provides a simple and powerful way to handle data fetching and rendering in web applications using HTML, reducing the need for complex JavaScript code or frameworks.

Related Reads

📰
Why SnapDOM Beats html2canvas for DOM-to-Image Capture
Learn why SnapDOM outperforms html2canvas for DOM-to-image capture and how to use it in your frontend projects
Dev.to · Juan Martin
📰
I built 42 landing page templates as single HTML files (no npm, no build step)
Learn how to create simple landing page templates as single HTML files without relying on npm or build steps, and why this approach matters for efficient web development
Dev.to · Segcam spa
📰
Part 7B — Section 2 — React Event Handling Explained: Forms, Event Object & User Input.
Learn React event handling for forms and user input to improve your frontend skills
Medium · JavaScript
📰
Stop Using window.resize for Everything: A Practical Guide to the ResizeObserver API
Learn to replace window.resize with the ResizeObserver API for more efficient and effective resize event handling
Medium · JavaScript
Up next
Elementor Angie Ai Plugin Tutorial
Quick Tips - Web Desiign & Ai Tools
Watch →