In a recent post I answered a general question about Web Components and their lack of widespread adoption. I’m back with what is probably the most frequently asked question about Web Components:
“If I’m already using React/Vue/Svelte, why should I rewrite my app with Web Components?”
And my answer is “You probably shouldn’t.”
Rewrites are painful and expensive. “Because I love web standards” isn’t enough justification for a rewrite. Don’t knock down a working system for a theoretical one. Only enter a rewrite if you’re trying to address a specific set of problems or have a specific goal. Before jumping headlong into any technology, it’s good to understand the problem space it’s trying to solve.
One hint at the problems Web Components solve is over on the site AreWebComponentsAThingYet.com. If you look at the nascar of logos on that page you’ll notice a trend… these all tend to be larger enterprise companies.
If your components only have one place to go, then you probably don’t need Web Components. Even if your components service a couple different apps or product teams that all use the same uniform tech stack, you probably don’t need Web Components. Where Web Components shine is when your components need to go to many places. Components in a large company not only need to go to the React app, they also need to go to the Drupal site, the old Rails app, the internal Java app, the Vue app, or the static Eleventy site some intern built; the list goes on and on. Web Components offer a path to deliver components without delivering complex build toolchains, so they can more easily graft into situations where teams face a wide surface area of languages and frameworks whether through decades of decision making, mergers and acquisitions, or chasing the latest hotness.
There’s other reasons that large companies filled with smart people have chosen Web Components over competing options. A short list of benefits that could be their own posts include:
- Greater portability between tech stacks
- Reduced framework churn
- Less tooling overhead
This doesn’t mean you need to go out and re-platform today. Use what’s working for you and your customers. But be sober about that second bit. I’ll leave you with Rupert’s Law of Web Components: As diversity of platforms increases within your company, so does the need for Web Components.