Being a developer is all about working as smart and efficiently as possible. In the true definition of that, a great way to achieve that would be by building out a general use component library to be used across your projects. So what could possibly be a framework/library that can achieve this seamlessly? Web Components!
In a lot of ways web components take care of the guesswork around the future state of JavaScript. In the ability to do this, it makes it the best technology to build a component library on.
Portability
In the past few years alone, JavaScript has had its fair share of framework/library of the moment. From MooTools and jQuery to React, Angular, and Vue now, there will always be something new taking dominance eventually. So with such volatility in the JS world, it takes a technology that is lightweight, natively supported, and easily ported into any framework/technology.
Enter Web Components. Web Components are a native technology, and have the capacity to be built in a way where they can mimic more popular and robust technologies we gravitate to today.
Modern Framework Like Features
While not very well documented, web components do come with a solid collection of features. When combined with well written logic based utils to fill in the blanks, the features natively supplied in Web Components are as good as any framework in reality.
As an example, look at how attribute values update. With combination of attributeChangedCallback
and observedAttributes
, a Web Component can monitor attribute value changes and have the appropriate callback logic called accordingly.
Easily Extendable
While Web Components come with a minimal, yet strong, feature set, it’s not overpowering. While that may be viewed as a limitation by some, it is more of a great opportunity. This is so because it gives the opportunity to build out the logic in any way that best works for your library.
Native JS Supported
This is a given for Web Components. Honestly, in my opinion, this is the best benefit. Having a technology to build with that is strong, as well as needing no additional packages to power, is something that should never be taken lightly.
In Closing
Building a baseline library of components to use in your projects is a great way to streamline your development process. While there are many options in doing this, the benefits found in Web Components make it an easy choice.