Why Small Dev Teams Should Ditch React for Server-Side UI Tools
Front-end frameworks like React are overkill for most web apps. I've long felt this in my bones, and over the past few years, I've watched excitedly as a new breed of tools has reinvented how we can build interactive UIs—without the bloat of complex JavaScript libraries.
Elixer's Phoenix LiveView kicked this off, but now Rails has Hotwire/Turbo, Laravel has Livewire, .NET has Blazor, and Unpoly can be used with just about any language you'd like. Their approaches vary slightly, but the gist is the same: deliver server-rendered HTML via Websockets to create an interactive UI previously only possible with a lot of JavaScript.
React, Vue, and other front-end frameworks are profoundly powerful, but the reality is that most web apps don't need them. Data Tables? Real-time form validation? Polling? Drag sorting? Dynamic select boxes? That one revenue chart the CEO wants? All super viable with these server-side tools.
If I were advising a company with limited engineering resources, I would recommend this approach for three crucial reasons:
You can write less code for the same result
These tools use your existing test suites, build and deployment processes, routes, and authentication. That means less code to maintain, fewer dependencies to monitor, and a smaller attack surface area for security risks.
You can write more performant code
By asking the server to do the work instead of the browser, you send more—but much smaller—requests as the user needs them, rather than downloading/parsing a giant JavaScript bundle on page load. The result is an app that feels much faster for the user, even when doing the same work. (Without too much effort, I can engineer sub-500ms page loads in PHP, for goodness' sake. Nobody has ever accused PHP of being fast.)
You can write code with fewer teammates
The cognitive bridge a Rails dev needs to cross to learn Hotwire is way, way shorter than learning React. This means that one developer can more efficiently work across the stack, allowing you to keep your teams lean and speedy and to make your overall dev budget go further.
Are there cases where React is more effective? Of course—nothing in web development is a one-size-fits-all solution. However, as someone who works across the stack—and has directly experienced these benefits in the last few months—I sincerely hope this particular trend sticks around.
What to Read Next
- Livewire creator Caleb Porzio gave a talk at Laracon 2023 introducing Livewire 3, and offered a great overview of the library's technical possibilities.
- Shortly after Hotwire was introduced, Matt Swanson from Boring Rails wrote a great article called "Thinking in Hotwire: Progressive Enhancement", which walks through the mental model of how Turbo, Hotwire, and Stimulus interact.
- Chris McCord, creator of the Phoenix framework, wrote a post in 2018 (!) introducing Phoenix LiveView, the OG of server-rendered HTML. It's interesting to read the original vision, and see how it's evolved in the last few years.
Last updated on May 1, 2024