Should I use raw web components?
CarbonHeartDev opened this issue · 6 comments
I got informations about the new Web Components standard and I'm thinking to use them in building the front end of a web application but I'm worried about a thing: in many places I read that they aren't meant to be created manually and used "raw" but more as plumbing to use in the making of front end libraries and frameworks that needs a way to specify reusable and encapsulated interface components.
What's your stance on that? In the context of a small project (in short it's a single page application with 3-6 views) should I ignore these warning and manually build Web Components in order to have a frameworkless application (I plan to include just some lightweight libraries) or it's better to find a good front end framework?
Hi @EmiSan1998,
I don't think that here someone can really tell you the answer. Nobody knows the context of your project apart from you and your team. Virtually with web-components, you can also have a different tool for every component.
In my opinion, you can start with simple and frameworkless Web-Components and then add a framework when you need it. This approach will follow the YAGNI principle: you can start simple and add them only when is needed. https://it.wikipedia.org/wiki/You_aren%27t_gonna_need_it
One of the tools that I use to choose if using a framework or not is the "Framework Compass Chart". It's a visual way to see the most important non-functional requirements of your project. You may find more information about it here
I've worked extensively using web components and as close as vanilla I can get, and let me tell you, after a couple of months you will have your own library.
You will start noticing some patterns on how you build things and create little helpers for this.
There is nothing wrong with this approach at all! Just be mindful of this.
I've worked extensively using web components and as close as vanilla I can get, and let me tell you, after a couple of months you will have your own library.
You will start noticing some patterns on how you build things and create little helpers for this.
There is nothing wrong with this approach at all! Just be mindful of this.
Have you got some public repos where you worked just with vanilla Web Components? I'm curious to know how you worked to take some ispiration for my projects.
@EmiSan1998 Most of that is inside the github enterprise instance. But I can write an article about it, set up some code examples in my public github if you want.
I think the only "concession" we made with this was use TypeScript. I can go in detail on the reasons in the article. If you have some specific questions, feel free to ask and I will add it to the post ;)
Hi @dvelasquez when your article is ready you may add a PR in our awesome list? https://github.com/frameworkless-movement/awesome-frameworkless ;)