Web Components are the Future

🌐web components tag

Web components are the future and present of frontend web development

Over the last few years I’ve drafted 4 posts that shared roughly the same sentiment. 2 were all but finished and none of them saw the light of day. This is because the projects I worked on changed and with them my stance ebbed and flowed. The short version is ā€œuse frameworks or don’t, I think the web standards and their custom elements will prevailā€. Here is a summary of each post:

A common theme through these was that state is still difficult to manage client-side. The community Context API, building on CustomEvents, is one way to ensure component states stay up-to-date with each other and you might also consider MutationObservers, OPFS, service workers, or some of the many other relevant web APIs. State management can become but one of the pieces we plug-in to our system. The point I’m making is that we can thin the layers that exist on top of web standards to bring us back to a more composable web, and with an interoperable development experience too.

Connoiseur XKCD 915 Connoiseur comic

Really, I think trying to write about this took a while because it’s a hill I’ll advocate for, but not one I’m willing to die on. Arguments against web components are fine, but they exist within what is really a small bubble. After all, the world at large accepts USB as a standard interface. Maybe the web development community can progress by doing the same with web components as well? Jared White has written up a similar sentiment well in their own blog post and Brad Frost argues in favour of web components with a bit more positivity - go check them out!