DEV Community

Discussion on: React or Vue or Something New?

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦 • Edited

Did you know the web platform has its own built-in component model? You can use shadow DOM to encapsulate your css - no more compound selectors, verbose naming conventions, preprocessors, etc. You can define your own html elements with custom elements and add your special behaviours, and you can efficiently render with template elements.

Check out my series on web components to learn more.

Collapse
 
proticm profile image
Milos Protic

Hi, yes, I'm aware of the web components and the shadow DOM, but I didn't get super deep into them. Very useful features, but it feels like that on every new project we need to recreate the framework.

Collapse
 
bennypowers profile image
Benny Powers 🇮🇱🇨🇦

The web components standards are very low-level. You're really not meant to use the vanilla APIs exclusively for large projects. On some projects, like you said, the best choice will be to write your own library to handle things like data binding, data flow, state container etc. But in most cases, the smart move will be to use an off-the shelf base class like LitElement for your components, with a state container like redux, or for example lit-apollo for graphql projects.

You can also use web components inside your existing framework code, since they are just html elements. I've used web components to solve problems in existing Vue apps, for example.