Building Scalable Client-side Components

Reusability and Independence is the key.

Components should be reusable, but they should be independent too. Every behavior must be driven by the component API, it shouldn’t be manipulated by outside. Also, components could have different variations, much like a button which can be for example, a small button, disabled, with icons etc.

Writing components is a good way to structure our client-side apps. However, we should be careful when writing and using them.

Observe an example of a <ui-button> component, and the logic that is applied to it, which can prove useful in any kind of component library or web-components.

You can find the article here, by Matheus Azzi.