4 ms·
Why would there need to be any sort of network request to show edit fields?
by robertoandred 4y ago
Why would there need to be any sort of network request to show edit fields?
- recursivedoubts 4y agowell, if you are using a hypermedia style application then you want to make a hypermedia exchange on an interaction to bring down the hypermedia representation for editing a particular resource
- robertoandred 4y agoSo any UI change requires a network round trip?
- holografix 4y agoYep and that’s ok in some cases.
- recursivedoubts 4y agoWell, there are UI changes and then there are UI changes. https://htmx.org/essays/hypermedia-friendly-scripting https://htmx.org/essays/hypermedia-friendly-scripting In general, I'd recommend perusing the essays to get a flavor of the style of web application we are advocating for: https://htmx.org/essays/ https://htmx.org/essays/ And, if you want more, taking a look at our book: https://hypermedia.systems https://hypermedia.systems
- mixmastamyk 4y agoNot required, you could still use js if you wanted.
- motogpjimbo 4y agoWhy don't you stop posting questions to this page and take the time to read the Htmx landing page? It answers all of your questions. https://htmx.org/ https://htmx.org/
- Dauros 4y agoBecause they are actually two distinct views: one is a details view, the other one is a form view. HTMX loads the form view and replaces the respective part of the page. But it needs to contact the backend for the form, you don't have the data model on the client like with an SPA framework, so you cannot generate the form.
- robertoandred 4y agoSo 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
- pier25 4y agoBecause the data might have changed between displaying it and opening the edit form.