Why use Function-Based Views (FBVs) for HTMX patterns
masterWhen developing HTMX-enabled views, it is strongly recommended to use Function-Based Views (FBVs) instead of Class-Based Views (CBVs).
FBVs are preferred because they allow you to:
- See the complete control flow: HTMX often requires conditional logic to decide whether to return a full page or a partial HTML fragment. FBVs make this flow explicit.
- Re-arrange the control flow: It is significantly easier to manipulate the logic required for HTMX responses within a function than within the complex inheritance structures of CBVs.
Using CBVs can hinder your ability to identify, extract, and implement clean HTMX patterns.