Article

July 4, 2023 | FRT Digital

Web Components vs Frameworks

Read more

The real decision isn't which technology to use — it's what you're optimizing for

July 4, 2023 | FRT Digital

The question "should I use Web Components or a framework like React?" frequently comes up in discussions about design systems and interface libraries. It's a good question — but the most useful answer starts with another question: who will consume these components and in which context?

What Web Components are

Web Components are a set of native browser standards that allow creating reusable interface elements without depending on any external framework. A button, a modal, a form field created as a Web Component works on any site — in React, in Vue, in Angular, or in plain HTML, without modification.

This portability is the main advantage and the main argument for choosing Web Components in certain contexts.

What frameworks like React offer

React, Vue, and other frameworks bring a rich ecosystem of tools, established conventions, and an active community that solves recurring problems. For building complex and dynamic interfaces — with state, elaborate interactions, data that changes in real time — frameworks offer mental models and abstractions that make development more productive than with pure Web Components.

The disadvantage is coupling: a component library built in React only works well in React projects. Reusing it in a Vue project requires rewriting.

When Web Components make sense

The most solid use case for Web Components is the design system that needs to be adopted by multiple teams with different technology stacks. A company with products in React, Angular, and a legacy system in jQuery — or that distributes a widget to be embedded in third-party sites — genuinely benefits from the native interoperability of Web Components.

The maturity of tools has evolved: libraries like Lit have made Web Component development more ergonomic. Large companies like Google, Adobe, and Salesforce use Web Components as the foundation of their design systems for exactly this reason.

When frameworks are the more pragmatic choice

For most companies with a homogeneous technology stack — the entire product in React, for example — building the design system in the same technology is the most efficient choice. The team already knows the model, the tools are more mature for this context, and the integration with the rest of the product is more natural.

Web Components in a team that exclusively uses React usually generates more friction than it solves, especially when the product has no real need for interoperability.

The practical decision

The choice between Web Components and frameworks for a component library should be guided by three questions: do the components need to work in multiple technological contexts? Does the organization have or will it have products with different stacks? Will the design system be distributed externally or to teams with different technologies?

If the answers are yes, Web Components deserve serious evaluation. If the answers are no, the pragmatism of using the same technology already adopted by the team is difficult to justify ignoring.

Articles

Enjoyed it? Read more on the subject: