News for hackers. Stuff that matters.
Re:Use web components for what they’re good at by nonethewiser on Wednesday August 23, 2023 @10:03PM (#37244244)
Well this is shocking

> It might also surprise you to learn that, by some measures, React is used on roughly 8% of page loads, whereas web components are used on 20%.

https://mastodon.social/@westbrook/110774427407999573

I suppose it’s because you can probably use web components on top of frameworks.

Re:Use web components for what they’re good at by benatkin on Wednesday August 23, 2023 @11:20PM (#37244631)
I looked at vercel.com and reddit.com - just React, no customElements.

Then at nytimes.com I found React and this:

    Yp = function(a, b) {
        var c = window;
        var d = void 0 === d ? wb : d;
        var e;
        if (c.customElements && null != (e = c.Reflect) && e.construct && !c.customElements.get("google-product-ad")) {
Real elegant.

After that I checked ask.metafilter.com and saw it has neither.

Re:Use web components for what they’re good at by MBCook on Wednesday August 23, 2023 @11:26PM (#37244662)
Figures. After seeing those numbers I couldn’t imagine custom components being more popular, so I figured it must be some popular library that people are using that uses them underneath.

Of course it’s ad-tech.

Re:Use web components for what they’re good at by benatkin on Wednesday August 23, 2023 @11:29PM (#37244675)
I use and like Web Components. But yeah this ratio doesn't bear out in articles and conversations with devs.

Edit: github.com has matches for both "react\b" and "customElements", and I expected that because I've read about Web Components on their blog.

Re:Use web components for what they’re good at by MBCook on Wednesday August 23, 2023 @11:46PM (#37244789)
I see people talk about React, Vue, and jQuery all the time. I occasionally see people talk about straight JS with no libs or Svelte. I may be able to recognize other framework names.

I literally can’t remember the last time I saw a mention of web components online, let alone an article about them.

Which is one of the reasons I was so interested to read this one.

Re:Use web components for what they’re good at by benatkin on Wednesday August 23, 2023 @11:58PM (#37244861)
Re:Use web components for what they’re good at by troupo on Thursday August 24, 2023 @01:29AM (#37245362)
> Web Components is starting to fit under this.

Nope. Vanishingly few people write web components without libs like lit or Stencil.

Re:Use web components for what they’re good at by benatkin on Thursday August 24, 2023 @02:29AM (#37245690)
Re:Use web components for what they’re good at by troupo on Thursday August 24, 2023 @04:46AM (#37246479)
You can find those lists for any tech, including Brainfuck and Malboge.

But then some time passes, and they end up implementing things like new search and code view in React: https://github.blog/2023-06-21-crafting-a-better-faster-code... :)

Even the most loud voices in the web component space almost exclusively advocate lit and stencil for development.

Hence "vanishingly few"

Re:Use web components for what they’re good at by scns on Thursday August 24, 2023 @07:33AM (#37247639)
> I literally can’t remember the last time I saw a mention of web components online, let alone an article about them.

My anecdata differs. There were several articles about them on HN in the last 6 weeks.

Re:Use web components for what they’re good at by pax_americana on Thursday August 24, 2023 @07:08AM (#37247447)
Reddit is actually undergoing a rewrite for their web frontend, which now heavily uses web components using lit. You can try it by accessing sh.reddit.com or using reddit without logging in.
Re:Use web components for what they’re good at by kevincox on Thursday August 24, 2023 @12:38PM (#37251036)
Wow, this is actually way faster than new.reddit.com. I may try it out over old.reddit.com. There is obviously a difference in that it emphasizes media content with large cards instead of the more dense old.reddit.com but that is preferable for some content. I'll have to see how it feels with more use.

The only major problem I noticed is that the "comments" button wasn't a link so you couldn't open it in a new tab. I don't know why web devs hate real links. They think the only think you can do with a link is click it to open the target page.

Re:Use web components for what they’re good at by troupo on Friday August 25, 2023 @08:28AM (#37260937)
Reddit is a company that seems to be chasing trends not understanding what they are.

I fully expect their site to become the same mess as their previous React re-write. I mean, it already is. There are people arguing that 2 seconds to load text and images is fast, actually: https://twitter.com/addyosmani/status/1678117107597471745 ("Engineering Leader, Google Chrome"). And they already load 109 JS files to display it.

Re:Use web components for what they’re good at by troupo on Thursday August 24, 2023 @01:28AM (#37245356)
Those numbers come from Google, and they plain refuse to break down stats, and remove Google's own sites from those stats.

Also IIRC those stats count page views, not pages. So, if you remove Youtube (which Google forced into web components as early as V0) ang Google's ad tech....