DEV Community

Discussion on: We Should Stop Hating Web Components

Collapse
 
mich profile image
Michel Tobon

Frameworks are not the language!
One of the points why I am so strongly inclined to use Web Components is because they are part of the web standard, while frameworks like React try to create their own standard, they also damage the opportunity to adopt tested and well developed standards.

I use Web components because specially at a large organization it simplifies the delivery of consistent design systems and solidifies the way we work in large teams, that is not to say I don’t use React, I do; but when it comes to delivering a set of components that can be shared and used across multiple fev experiences, web components provide a solid and standard set of tools that go directly to the browser instead of going through the build system.

One of the reasons why I believe developers are affraid of web components is because some of them are not consumed as dev/build time dependencies but as runtime dependencies, but this is the way javascript really works, in the window you are not working with your framework of choice anymore, you have left that nice IDE world and now you are working with the browser’s operation.

I think it is of most importance to know the platform you are working with before even knowing the ways to simplify development on it. Web components are a great native way to encapsulate logic, style and markup within a container that is standardized and unified across (most) browsers. Give them a try

PS: of you do miss react, Stencil’s dev experience is ~95% the same

Collapse
 
theharshsingh profile image
Harsh Singh • Edited

Yes, but style encapsulation is also presented as its biggest con. but that is not true. developers dont have to use Each and Every technologies of the web component suite. if you dont want style encapsulation then just dont use Shadow DOM at all! and if you are following BEM methodology, you will not see any side-effects. Shadow DOM is just for heavy, self-dependent Web Components. and yes Stencil's DX is almost the same as React. and there are also Hybrids.js and Switzerland.js if you want to write functional web components that are quite similar to the React ones.

Collapse
 
mich profile image
Michel Tobon

Agreed!

Most of thetime I don’t use shadow on my web components but for enclosed design systems I would argue that style encapsulation is really good it does prevent major style collision problems when working at larger scales

Collapse
 
ekanadily profile image
Esam A Kanadily

Do you think that web components is ready? i mean do they have what is required to make whatever a dev might need. or they still need impovments?

Collapse
 
theharshsingh profile image
Harsh Singh

Short Answer: Yes! Web Components are ready for production.

Long Answer: it really depends on what kind of project you are working on. for a small to medium size product web components are perfect. but if it is going to be a big project, then due to lack of resources and support, you will have to build many things on your own which are readily available in other frameworks.