4 ms·
So any UI change requires a network round trip?
by robertoandred 4y ago
So any UI change requires a network round trip?
- neurostimulant 4y agoYou're probably comparing htmx with client-side framework like React. Unlike those client-side ui framework, htmx is used to enhance standard html pages, such as those outputted by server-side web framework. Those frameworks typically renders detail and form page separately, and htmx can combine them into a single interactive page. For example, when you reply a comment in HN, it'll open the form as a new page, and when you submit the comment, it open another page. htmx can combine all of those pages into a single interactive page.
- robertoandred 4y agoBut it's still as slow as two separate pages?
- neurostimulant 4y agoShould be a bit faster because it only requests a piece of html fragment which then get swapped into the dom instead of reloading the whole page again.
- recursivedoubts 4y agothere is a good talk on a real world react->htmx port here: https://htmx.org/essays/a-real-world-react-to-htmx-port/ https://htmx.org/essays/a-real-world-react-to-htmx-port/ in which improved performance features as a big part of the realized benefit of the conversion of course, not every application is going to be amenable to a hypermedia-style approach, so your mileage may vary: https://htmx.org/essays/when-to-use-hypermedia https://htmx.org/essays/when-to-use-hypermedia
- andybak 4y agoSlower than what? In my experience, simple page loads are usually blazingly fast assuming you're not on 2g or something. It's heavy client-side frameworks that often feel slow.
- robertoandred 4y agoYou've never used backend frameworks like WordPress? They can be very slow.
- andybak 4y agoYes. That's why I specified "simple page loads". If your frameworkless website is slow then the fault doesn't lie with the nature of http or the intrinsic overhead of full page loads. You've got a shitty backend framework, database or network.
- switch007 4y agoAre your (repeated) questions in good faith, or are you taking a swipe at the project?
- john2x 4y agoI'm hoping a future version will allow using hidden markup that's already in the DOM rather than fetching from the server.
- Dauros 4y agoIt's already supported with the client-side-templates extension [1]. HTMX can fetch JSON from the backend then calls e.g. nunjucks.render() with the data. [1]: https://htmx.org/extensions/client-side-templates/ https://htmx.org/extensions/client-side-templates/
- dalmo3 4y agoOn a sufficiently long timeline we'll see full SPA frameworks on top of htmx ;)
- Dauros 4y agoNot at all, you can preload as many data as you wish and use vanilla or a companion JS framework like Alpine.js or HyperScript or any web-component to make the current page interactive without fetching the backend. It's a trade-off between the initial page size vs. additional network delay.