Don’t Use React Server-Side Rendering
The Coming Technical Debt Will Crush You
React is a great front-end UX library. Period.
Server-Side Rendering is Scope Creep
In enterprise development there is a thing called scope creep. You can likely figure out what it means. It has nothing to do with ES6+ block scoping (although you could call
var a scope creep and almost maintain that meaning). It is when you start expanding what you are including in a project almost imperceptibly until one day you no longer recognize the monster you have built or what its base function is.
You Do Not Need SSR
The main reason very intelligent people cite is that “Google can’t search index my React site.” If this is true, maybe there is a bigger design problem staring you in the face that you cannot see through your React-clouded glasses.
Nothing that has React components in it should depend on search.
Many of you will immediately begin raging and preparing your flaming responses. That’s fine. But at least pause to consider the question and sincerely ask if you had to have that React component.
Hell, I have run across entire sites rendered with React on the main home page. There just is no need for that—especially not now. Here’s why.
Static + Serverless + Progressive Web Apps
What does this have to do with React SSG?
The preferred architecture these days really is static + serverless + PWA. It is the most modern in every way.
- It allows no complications at all for search engines
- It allows your content to be served from powerful CDNs such as Netlify (or even GitHub these days who just announced HTTPS support and has a massive CDN as well)
- Backend logic and data storage can be built into AWS Lamba functions (directly from Netlify even)
- Full app UX can be built (with full material design) into a PWA that can be downloaded directly from your static site
The best advantage of not building in a dependency on Node to render React on the server-side is that you have not built yourself into a server dependency (like PHP all over again).
Case you have not heard, serverless is all the rage and for very good reason. It allows your content to be quickly loaded and distributed.
Prepare Ye, For Decentralized Computing Commeth
Not so quietly, in a tech galaxy far, far, away (as far as most UX people are concerned) the roots of a fully decentralized Internet have already taken hold. “Cloud computing is dead,” says Muneeb.
I happen to think the cloud will be alive and well for a very long time, in fact, it will never truly die. But we are definitely looking at a massive schism between centralized web technology and decentralized information sharing and app distribution.
How does this relate to React SSG?
It renders it into a complete and total anti-pattern. Content dependent on server rendering of UX (that don’t even perform well, btw, v.s. something like Go) are absolutely, completely dead. They would have been dead even without the need to allow content to live and be distributed in any way the future has in store. But the likelihood of having to encapsulate your entire content statically is assured with the coming decentralized addition. This approach is the only one that will work on both centralized and decentralized systems. Thankfully, the JAMstack model has not only prepared us for CDN efficiencies and reduced complications but also put us in a position to be ready for a day when there are no servers because everything is decentralized.
The Good News
React is the UX king, love it or hate it. We have a winner. People will continue to make amazing things in other libraries, but as a universal UX library—with all its components out there and (finally) a permissive license—React clearly wins.
There is some irony in the fact that one day React and Web UX technology may not even be primarily used on the Web as we know it today. One possible decentralized future has everything as apps with crypto-tokens and self-sovereign identities attached.
React moves into the space of widget libraries like Qt or GTK as we already see in Electron apps be they fat now but a glimpse into a future where all things GUI are React, Qt, or Unreal Engine.