News for hackers. Stuff that matters.
Re:Web Components Eliminate JavaScript Framework Lock-In by robin_reala on Monday November 27, 2023 @12:31PM (#38435237)
React “won” because Facebook spent three years flying devrel to every web conference on earth to persuade other people that Facebook’s problem space was applicable to small agencies.

Back in reality, React is slow and massively overbuilt for the majority of stuff that most people are building.

If you played around with Web Components a long time ago then you probably played with the v0 spec, which was somewhat different to the current version.

Re:Web Components Eliminate JavaScript Framework Lock-In by JamesSwift on Monday November 27, 2023 @12:40PM (#38435374)
React "won" I think because it trojan horsed itself as being "just the view" but then morphed into a hand-rolled kitchen-sink solution, and inertia kept people around.
Re:Web Components Eliminate JavaScript Framework Lock-In by jeremycarter on Monday November 27, 2023 @04:21PM (#38438494)
Accurate quote. Source: I was there.
Re:Web Components Eliminate JavaScript Framework Lock-In by paulddraper on Monday November 27, 2023 @01:21PM (#38436000)
!!!

If React won, it was precisely because it was not "overbuilt."

It was simpler (deliberately) than Backbone, Angular, Vue, Svelte, etc.

You can implement a React clone in a few hundred lines, a la Preact.

Re:Web Components Eliminate JavaScript Framework Lock-In by levitate on Monday November 27, 2023 @02:13PM (#38436785)
I would not say that React won over svelte because of simplicity. Hate what you will about implicit behaviors in svelte, but the syntax is simple and intuitive.

React won by being early and different. Svelte came out three years after React and got (unfortunately) steamrolled.

Re:Web Components Eliminate JavaScript Framework Lock-In by paulddraper on Monday November 27, 2023 @02:18PM (#38436858)
There two notions of "simplicity."

One is that the implementation is very simple/transparent, e.g. C.

The second is that it allows users to have very simple code, e.g. Python.

React is mostly the first with a bit of the second. Svelte is the reverse.

Re:Web Components Eliminate JavaScript Framework Lock-In by troupo on Monday November 27, 2023 @12:34PM (#38435277)
> React “won” because Facebook spent three years flying devrel to every web conference

You do know that Google sponsored and ran things like Polymer conf? That it builds lit? That Google's devs have literally overrun and overruled most web specs committees? That Google has spend hundreds of millions of dollars promoting Web Components?

And yet here we are.

Re:Web Components Eliminate JavaScript Framework Lock-In by robin_reala on Monday November 27, 2023 @12:46PM (#38435449)
Polymer was incredibly even slower that React and even more overbuilt, and it had the added negative that it tried to enforce a visual style as well, which was too much for most people. Google couldn’t spend its way out of that hole.

As for Web Component specs, we got v1 because of Apple and Mozilla: Google would happily have stayed with v0.

Re:Web Components Eliminate JavaScript Framework Lock-In by pseudosavant on Monday November 27, 2023 @01:34PM (#38436191)
I'm glad to have read this today. I'm going to look into how I could use web components in my next side project. I'd really like something that worked easily with SSR and client-side, maybe using htmx.

In retrospect, I think I avoided web components because of Google and their aggressive dev relations pushing Polymer. It felt so one-sided that it didn't seem like a web standard. It felt more like a Google "standard" like NaCL. Having to ship Polymer to support non-Google browsers felt even more heavy weight than React.

Re:Web Components Eliminate JavaScript Framework Lock-In by troupo on Monday November 27, 2023 @03:45PM (#38438010)
> I'd really like something that worked easily with SSR and client-side

Then you should skip Web Components :)

Re:Web Components Eliminate JavaScript Framework Lock-In by robin_reala on Monday November 27, 2023 @03:53PM (#38438109)
For sure. SSR is one thing that React has done well, and that Web Components don’t have a great story for.
Re:Web Components Eliminate JavaScript Framework Lock-In by pseudosavant on Monday November 27, 2023 @04:01PM (#38438227)
I'm pretty sure that just shipping the HTML works. The nice thing if I use web components is that I can just have my backend create HTML that uses those components. I can create elements whatever way I want on the backend or the front-end so long as it is HTML.
Re:Web Components Eliminate JavaScript Framework Lock-In by robin_reala on Monday November 27, 2023 @04:23PM (#38438531)
Yes, if you stick to custom elements. If you want shadow dom encapsulation then you’ll need to wait for declarative shadow dom to turn up in all browsers.