Live data from Hacker News

Web Components could replace frontend frameworks?

dannymoerkerke.com

51–60 of 248 posts

Re: Web Components could replace frontend frameworks?

#51
post #20

Earlier quoted context omitted.

what about slots?

Slots require shadow DOM which means there can be performance and CSS issues on widgets designed for local use with shared CSS. But I agree they’re also an option. :)

Performance issues? Native Shadow DOM, especially with Constructible Stylesheets, is a perf boost. Limiting style resolution to smaller scopes and less rules is good.

Re: Web Components could replace frontend frameworks?

#52
The reality of Web Components is that it was never intend to take share away from the large frameworks. Instead Web Components is intended to fill the middle ground between a simple web page and a full blown web application. There is a real need for web page developers to be able to just drop in a prebuilt web component and go without having to reach for the 10,000 pound gorilla of frameworks. That’s where Web Components can have real value, real benefit.

Is Web Components flawless, hardly. While the APIs are accepted standards and implemented in most browsers there are still a few holdouts, and to be sure there are still edges to iron out. No technology is without it warts, its awkward teen years. But Web Components is maturing and the tooling around it is maturing as well and Web Components most definitely has a place and is most definitely here to stay.

Also it is worth keeping in mind that the Web Component APIs are specifically written as low level APIs and intend to be built upon by libraries and frameworks to simplify and aid the process. Libraries like the one I am currently pitching, ZephJS [1], which aims at making writing and distributing web components mind numbingly simple to do. ZephJS is a perfect example of the new generation of Web Component libraries to facilitate answering the need I espouse above: the middle ground between basic and beast that so many web developers live in.

[1] Introducing ZephJS: https://gist.github.com/arei/8083a6270e704b830c68a2020f3e5e3...

Re: Web Components could replace frontend frameworks?

#54
A couple of days ago I saw a project here called pika which is any npm package it seems running in the browser, it's interesting to have the web components + pika where we can bring in different modules from npm and combine that with the power of web components then there really is no need for other frameworks but.. it brings that problem we used to have with JQuery which is lack of standards.. it seems we keep on going around in circles but web components are a lot faster and easier then React or Preact.. and the routing thing just makes everything fat for the bundles... then you have to worry about bundle splitting... the main/core bundle... pika is a good one because it takes the bundling off the bat and makes everything easier without the routing.. I now wish for a standard with web components and pika and doing the polyfilling... and ... material framework... and.. some coding standards just so we don't get a mix of Jquery and react and preact and a lot more in one single page load.

Re: Web Components could replace frontend frameworks?

#55
Being native to the browser, how fast is it compared to React? It is 10x faster because it's native? Is it on par, with room for browsers to improve it's performance even further?

I'm all for something that's native to the browser.

Right now you write a `

` tag for a paragraph element. No question about it. Imagine if you needed to use a P-tag library just to render a paragraph tag? Of course not right, you would just use the native browser `

` tag. I think that React is a P-tag library in essence.

I would go all-in for a native version of "frontend framework".

Re: Web Components could replace frontend frameworks?

#56

Earlier quoted context omitted.

> Web Components don’t offer a declarative way of updating the DOM; What does that mean? The methods provided by the web components spec appear declarative as do the methods provided by the DOM spec. Declarative example with nothing like innerHTML: https://developer.mozilla.org/en-US/docs/Web/API/Element/att... Either way this discussion is stupid as updating the DOM is stupid simple even without a framework. The DOM…

> * stupid - https://github.com/prettydiff/wisdom/blob/master/Delusional_... It seems you wrote this article; have you read it back? You bury the lede under 1230 words explaining some social concepts rather than anything programming-related. Additionally, you use many complex words to describe simple subjects. And you do this knowingly: for example, you felt the need to link the definition of "acquiescence" to the wo…

A wiser man than me once said its hard to have rational conversations on this matter because delusional people more invested in their opinions than they are in the work they perform.

Re: Web Components could replace frontend frameworks?

#57

Web Components don’t offer a declarative way of updating the DOM; it’s still `innerHTML` and using DOM APIs to edit the state of the live DOM. Backbone was a hassle to manage in any sizeable app because updating the view was left up to every dev to figure out themselves. React brought a declarative wrapper around the statefulness of the DOM, and that is the killer feature that Web Components does not offer at all. Vu…

[deleted]

Re: Web Components could replace frontend frameworks?

#58

Earlier quoted context omitted.

Slots require shadow DOM which means there can be performance and CSS issues on widgets designed for local use with shared CSS. But I agree they’re also an option. :)

:part and :theme CSS puesdo-selectors will help address these issues

you can also use :host, which target the custom element specifically (and using :host on custom-element children does not, from what I recall off hand, get broken when nesting) and then target its children.

Also, css variables can be global and still enter into the shadow-dom unobtrusively (This is without using the polyfills, though, I believe this is a limitation in the polyfills currently, which might be why that part of it has been confusing in the past.).

Re: Web Components could replace frontend frameworks?

#59
post #50
post #42

Ploymer was a crapshow and HTML import a nightmare for load times. Unless some sort of topology bundling is provided for web components I'm out. We tried to do generic components for multiple frameworks based in webcomponets and it was an utter failure in practice especially for low band networks.

To be fair, HTML imports is deprecated and won't be standardised. The recommended way to package web components now is with ES modules, and they can be bundled (with eg. Rollup or Webpack.)

That is great, but I am still 100% sceptical of a web component intergration with any given framework. Is the integration point opinounated? Is it reactive, callbacks? Two way bindings? What does the application lifecycle look like? Would it be just opiononated sets of components? I just don't know... If I'm wrapping web components to meet our design patterns then why bother at all? I feel like the entire web component concept from an API level is a great concept but just not there for real world at scale consumption. I may just be not optimistic about it all.
Post reply on HN