htmx vs React: choosing where your UI's logic lives
htmx is itself a JavaScript library that keeps UI behavior in HTML attributes and server-rendered fragments; React builds UIs from components with client-side state, and can be adopted incrementally or server-rendered through frameworks. Shipped JavaScript depends on the implementation, not the label - the architecture trade-offs, from htmx.org and react.dev, read 21 November 2026.
Per htmx.org and react.dev, read 21 November 2026: the popular framing of this choice - "htmx means no JavaScript, React means lots" - is wrong on both ends, so this article does not use it. htmx is itself a JavaScript library: per its documentation, "a dependency-free, browser-oriented javascript library" you add with a script tag, no build system required. React does not have to mean shipping a full SPA: it can be adopted incrementally and run through server-rendered frameworks. How much JavaScript a given site actually ships depends on the implementation, not the technology label. What genuinely differs is where your UI's logic lives and how the browser gets updates - and that architecture choice is worth making deliberately. (For where the HTML itself is rendered, see our SSR, SSG or CSR guide.)
htmx: behavior as attributes, updates as HTML
With htmx, per its documentation, the core is "a set of attributes that allow you to issue AJAX requests directly from HTML". You annotate an element - say, hx-post with a URL - and when the element's natural event fires, htmx issues the request; by default, requests are triggered by the natural event of the element, and the response is swapped into the page as an HTML fragment (the docs' example uses hx-swap="outerHTML"). Your server answers with HTML, not JSON. The mental model: the server stays the source of truth for both state and markup, and the client-side library is a thin engine that wires events to requests to swaps. CSS transitions and an extension system (the docs list both) cover richer behavior without leaving that model.
React: components, state and event handlers in JavaScript
With React, per its Learn pages, apps are made of components - "a piece of the UI that has its own logic and appearance" - and interactivity means declaring event handler functions inside those components and updating state so React re-renders. The mental model: the UI is a function of client-side state, and the JavaScript in the browser owns the interaction logic; your server typically answers with data (often JSON) rather than finished markup. That buys precise, local control over complex interactions - the trade is that state synchronization between client and server becomes your engineering problem, and the browser must download and run that logic before it can use it. Server-rendered and incremental-adoption paths exist within React's ecosystem; "React" does not prescribe one rendering strategy.
Where the real trade-offs sit
State ownership. In the htmx model, authoritative state lives on the server and every interaction round-trips to it - simple to reason about, and every interaction pays network latency. In the React model, interactive state can live in the browser - instant feedback for things like drag interactions, multi-step forms and optimistic updates, with sync complexity as the cost. Neither model has a hard ceiling: htmx has extensions and works alongside plain JavaScript for the spots that need it, and React apps can lean on server rendering and server data. The honest question is which model carries the bulk of your UI, because mixing is common - many products server-render with htmx-style interactions for most pages and embed a React component where client-side state earns its keep. Team and tooling differ too: htmx asks for solid server-side templating and no frontend build step by default; React asks for a JavaScript toolchain and component discipline, and pays back with a large ecosystem of libraries and hiring familiarity.
How the choice usually plays out
Server-rendered product - an admin panel, a content site with interactive islands, a CRUD app - where most interactions are "click, server updates, show result": htmx's attribute model keeps the architecture in one place and the docs' no-build-system default keeps tooling light. Highly interactive surface - a canvas editor, a live dashboard with drag and resize, a multi-step flow with optimistic updates: React's client-side state model fits, because round-tripping every gesture to a server is the thing it exists to avoid. Mixed product: server-render the bulk, embed components where client state earns its complexity - a legitimate architecture, not a compromise to apologize for. And if your actual question is whether the HTML should be produced in the browser, on the server per request, or at build time, that rendering decision is covered in our SSR, SSG or CSR guide; it stacks with this one.
Sources, all read 21 November 2026: htmx.org, Documentation ("dependency-free, browser-oriented javascript library"; no build system required; attributes issuing AJAX requests from HTML; natural-event triggers; hx-swap fragment swaps; CSS transitions; extensions); react.dev, Learn (apps made of components with their own logic and appearance; event handlers declared inside components; rendering conditions and lists; sharing data between components).
Choosing how much JavaScript your site really needs? Omnistu's Web and Frontend practice works on marketing sites, customer portals and single-page applications - write to team@omnistu.com with what you are deciding.
Frequently asked questions
Does htmx mean writing no JavaScript?
No. htmx is itself a JavaScript library - per its documentation, "a dependency-free, browser-oriented javascript library" added with a script tag. The difference is that your UI behavior lives mostly in HTML attributes and server-rendered fragments rather than in JavaScript you write and ship yourself; htmx's docs also list extensions and it works alongside plain JavaScript where you need it.
Does choosing React mean building a full single-page app?
No. React supports incremental adoption - you can add components to an existing server-rendered page - and its ecosystem includes server-rendered frameworks. "React" describes a component and state model, not one rendering or delivery strategy; how much JavaScript a React site ships depends on how it is built.
Which one ships less JavaScript?
It depends on the implementation, not the label, so this article makes no bundle-size comparison. A no-build htmx page ships the htmx library plus your markup; a React page ships React plus your component code, unless it is server-rendered. Measure your actual pages with your browser's dev tools rather than trusting either side's marketing number.
Can I mix htmx and React in one product?
Yes, and many teams do: server-rendered pages with htmx-style attribute interactions for the bulk of the UI, and embedded React components for the specific surfaces where client-side state (drag interactions, optimistic updates, complex multi-step flows) earns its complexity. The two models solve different layers of the problem.
Is htmx only for small projects?
There is no such rule in its documentation. htmx's model - server as source of truth for state and markup, attribute-driven requests, HTML fragment swaps - scales by keeping logic on the server you already scale. What it does not give you is a client-side state system; if your UI is dominated by instant, local, high-frequency interactions, that model (in React or elsewhere) is the better core.
Is this the same decision as SSR vs CSR?
Related but not the same. SSR/SSG/CSR is about where the HTML is produced; htmx vs React is about where interaction logic lives and how updates reach the page. They stack: you can server-render HTML and drive interactions with either model. Our SSR, SSG or CSR guide covers the rendering question.