Overview

Motivation

There are lots of ways to create Web Components, so do we really need another?

One of the great things about Web Components is their universal nature and interoperability. However you create a component - be it using one of the great libraries linked above, using the browser API directly, or using Wafer - you do so with the knowledge that it can be used anywhere HTML can, and that you can change your implementation at any time and the component will continue to work wherever it is used.

So to a certain extent how you implement your components is not important, the fact that you are leveraging the power of Web Components is the key.

There are however a few thoughts to keep in mind depending on how you intend your components to be used. Due to their universality you could be using them to:

  1. create a self contained app, where the components are quite specific and are unlikely to be used elsewhere
  2. create a UI library of components to be used together with each other in another library, app or site
  3. create a one-off component that is used alone in any library, app or site

Of course you can use any library to achieve any of these use cases. For options 1&2 in general, where many components of the same type are being used, the relative size of the library you choose (and associated cost in terms of performance), in comparison to the overall app/site will often become insignificant.

But for option 3, for single use components, library size can become more of a consideration. When you are using a single component, on it's own or within another library, it often exists in isolation so that you need to absorb the cost of bringing the whole library that it was implemented in with you.

For the smallest components you would benefit from not using a library at all, while for a large component the size of the library may be dwarfed by the overall component size. It is for the cases in between that Wafer was developed - a small, easy to use library for creating small to medium sized one-off components, providing the key features you expect from a reactive component while keeping size to a minimum, and providing a simple way to render those components on the server too.

Of course there's nothing stopping you from using Wafer for any sized component or app - try it, you just might like it 😉

Next: Installation Previous: Introduction