DEV Community

Discussion on: Why the React community is missing the point about Web Components

Collapse
 
alexmorleyfinch profile image
Alex

You are forgetting a very important problem that React was intended to solve... That is excessive DOM manipulation with native javascript. You can say WebComponents are good and well supported and safe, but you can't say that the devs implementing the web components are any more knowledgeable about DOM bottlenecks than they were 5 years ago. React only updates the DOM when necessary. Remember when we had monolith front-ends with jquery, and every piece of javascript having a slice of the DOM pie? How is WebComponents gonna solve the problem of batching and optimising DOM reads/writes on a monolith codebase?

Collapse
 
briancruickshank profile image
Brian Cruickshank • Edited

lit-html provides a good example of how to solve that problem in a way that works well within a Web Component context: From npmjs.com/package/lit-html/v/0.2.1 :
lit-html's method of creating HTML templates with markers for dynamic sections, rather than updating the final DOM tree, enables efficient updates of previously rendered DOM