5 ms·
I do pretty much everything with Web Components these days. It's so nice to be able to pick things I need from different frameworks, like Ionic, vaadin, Shoela
by claytongulick 5y ago
I do pretty much everything with Web Components these days.
It's so nice to be able to pick things I need from different frameworks, like Ionic, vaadin, Shoelace, etc... and they all just work together.
I tend to implement vanilla web components, I enjoy managing the life cycle and don't find it particularly burdensome. Of course. Lit-html is a big reason why that's easy to do. I use it for rendering. I generally avoid using the shadow dom unless I have a really good reason.
My components all self-register, and are pretty encapsulated. They all maintain internal state, but for more global state I use a library I wrote called ApplicationState [1].
It's hard to imagine going back to the framework churn after experiencing the freedom of Web Components.
It really feels like we've finally realized the promise of composability, reusability, encapsulation and performance with Web Components.
[1] https://claytongulick.github.io/applicationstate/ https://claytongulick.github.io/applicationstate/
- laurent123456 5y agoI don't know if it's on purpose, but ApplicationState is a lot like Redux, except the action dispatching mechanism has been replaced with setting state properties directly. I'd still prefer the dispatch mechanism since it means you can have additional, reusable logic in the reducer.
- claytongulick 5y agoIts design was specifically intended to avoid the extra code involved in dispatching. There are also some other goodies in there like aliasing that I enjoy.