Remix.run Logo
foobarbecue 6 hours ago

I skimmed this. I use web components a lot. Unless I'm mistaken, they don't provide reactivity; you have to write that yourself. Reactivity was the feature that launched modern js frameworks so I think the article really overstates the case.

The article also misses something more important: broad native ES module support in browsers means you don't need a build step (webpack).

The "AI makes it easy!" part of the article makes me want to hurl as usual. And I'll stop short of an accusation but I will say there were some suspicious em dash comparison clauses in there.

g947o 4 hours ago | parent | next [-]

Yes. You can tell the author either doesn't have experience using web components in a non trivial page, or they are intentionally hiding the complexity. Realistically, you don't want to make pure web components. You want to use a framework to build it for you.

Put it another way, you can make a page out of web components without using a framework, but you are not going to convert a React page with that approach.

dankobgd 6 hours ago | parent | prev | next [-]

you have `observedAttributes` and a callback to react whenever they change. That is basically it.

desdenova 5 hours ago | parent [-]

You can use lit-html to get declarative reactivity, but then it's just basically react again.

tym0 6 hours ago | parent | prev | next [-]

Do you still have to pass every args as json/strings or has there been an improvement on that front?

balloob 5 hours ago | parent | next [-]

This has never been the case. Custom elements are DOM Elements and so are just JavaScript objects. Just like you can do aEl.disabled = true, you can set any prop to any type of value.

gedy 3 hours ago | parent [-]

I think they mean in the markup via <some-tag data={anObject}> ala React, svelte, etc.

lloydatkinson 5 hours ago | parent | prev [-]

It's still exactly like that.

lloydatkinson 5 hours ago | parent | prev [-]

> they don't provide reactivity; you have to write that yourself. Reactivity was the feature that launched modern js frameworks so I think the article really overstates the case.

This is the truth that a lot of web component advocates gloss over on purpose. They know this, just like they know that there's no decent templating solution either as tagged template literals still need escaping. Then there is efficient DOM updates, etc. (aside, I got Claude to write a web component recently, and it's code had every single keystroke assigning the same class to the element)

There are many features like this, and when you finally get them to admit it, they just say "write your own"!. Well guess what, frameworks already provide all of this.

The really funny part is that Stencil, one of the popular tools for writing web components actually does provide all of the above! Their web components have exactly the same type of features you'd expect in any other framework *because it IS a framework*.

Which again highlights how stupid the discourse is here. It's not "independence" of frameworks, your components will still depend on a framework of some kind, be that Stencil or Lit or whichever thing YouTube uses now or your own supporting code to get back even half the features you get elsewhere.

It all starts to make sense when you realise that the Chrome developers hated frameworks because they didn't understand them, pushed for web components, not realising frameworks dealt with all of the above.

https://youtu.be/UrS61kn4gKI?t=1921 32:00 (but the whole video is valuable and I wish everyone on both sides of this debate would watch the whole thing).

I think the only thing I like about web components is they scope "this" to the element it owns.

lloydatkinson 3 hours ago | parent [-]

Not that votes matter on HN, but I do find it typical of the type of discourse around Web Components I dislike. My comment had +3, now it has 0. It seems no one is able to admit WC's have big problems.