DEV Community

Discussion on: Maybe Web Components are not the Future?

Collapse
 
drdreo profile image
Andreas Hahn

To quote the conclusion chapter of my master thesis:
Component-based UI libraries have been the standard for building feature-rich applications and modern web frameworks like Angular, React or Vue allows developers to assemble the user interface from reusable components. The big difference between these frameworks and Web Components is that Web Components do the componentization on the native DOM level. Although, their goal is not to replace these frameworks since frameworks focus on a reuse-based approach to defining, implementing and composing loosely coupled independent components into systems. These systems glue components together and can provide much more functionality than encapsulating building blocks. Nonetheless, Web Components can enhance those frameworks and have the potential to replace their component layer with a native and uniform solution when the time of disappearing frameworks has come.

Collapse
 
ryansolid profile image
Ryan Carniato

Yeah it seems reasonable. Although I think disappearing frameworks is a myth. Even Rich Harris has changed his tune a bit on the role compilation takes in the process. I'm not saying it isn't doable or people won't do it. It's more like a design system that butts its nose into every styling decision you make, I think you will see UI frameworks get more intrusive like this. Their ability to orchestrate the experience is something we are seeing more of. And in so while the weight of the runtime is being reduced the reach of the libraries is not. Conventions and patterns are still being applied if only to be statically analyzed and ultimately define the compiled output. This doesn't mean the result is more generalized.

In that world, only the simplest of components have any place(ignoring micro-frontends for a moment). Better organizational patterns like inversion of control only makes this harder when you need the children calling the shots (think Suspense, Context API). I do think this somewhat comes down to the perception of reusability. See I don't see React Components as that much of a re-usability mechanism. Sure you can, but more that their modularity makes them replaceable. You throw out a piece without throwing out the whole system. Whereas Web Component's value has to be in generalization and re-usability to be compelling over what the library already has available. Basically patching holes in the native controls we lack. Which is fine but it also means that we are talking about a much smaller scope.