With some constraints you can create a page that works with or without JS. The same endpoint can be used for serving HTML fragments for HTMX and full page for JS-disabled clients since the HTMX request can be detected by the HX-Request header.
Didn't that used to be called AJAX or REST or something?
https://enmascript.com/articles/2019/09/26/toggle-content-on...
I don’t like messing with the URL to achieve this, so unless using the “details” element, maybe JavaScript is actually the best approach…
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:
It's heavy client-side frameworks that often feel slow.