Re:Web Components could replace frontend frameworks?
by tobyhinloopen on Friday April 12, 2019 @02:26AM
(#19642475)
Frameset / iframe?
[ Parent
| on HN ]
Re:Web Components could replace frontend frameworks?
by galaxyLogic on Friday April 12, 2019 @07:40PM
(#19650017)
You are right. IFrame creates an almost but not totally isolated page-environment. So in a sense IFrames are 'web-components".
So what can Web-components offer over that? A simpler way of including them on a page with a single tag. Well, you must load the js-file too but a single js-file could contain multiple web-components I assume.
The whole (?) point of components is isolating the interface from implementation, encapsulation, which WebComponents does nicely by providing a standard way of writing methods of the underlying ES6 class.
We could say that WebComponents are smarter IFrames with a cleaner way to declare their interface.
Another great thing about WebComponents is extending existing tags which makes it easy to prototype improvements to existing tags. For instance I wonder if IFrame could be made better by creating a web-component that extends them?