by _boffin_ · 3y ago · 0 comments
Question: when and or if they gain in adoption, could you see them replacing react? If not, what’s the use-cases that you believe they wouldn’t work for?
I tried to get into WebComponents, but the MDN tutorial has you writing a lot of `document.createElement` and `document.appendChild`, which is the sort of imperative stuff I don't like about vanilla JS DOM manipulation.
Ay.
Can you please explain what this means in simple, 5th grader English?
Vanilla JS says how to do things (find these HTML elements and update them by doing X).
It is much simpler to track and mutate a state object, than it is to find all the nodes you need to update and update appropriately.
Frameworks like react/angular/backbone/vue solve the problem of creating a single page application with a nice architecture and sharing code between components within the SPA.
Web components solve the problem of sharing code between any application.
There are opportunities to share code (eg/ data binding) and I believe that is the case (they use the same underlying browser APIs where available)