top | item 40290891

(no title)

danielrhodes | 1 year ago

It seems like Web Components are ideal for libraries shipping pre-built components, which is probably why Mux finds it compelling. From Mux's point of view, they want the highest level of compatibility with the least amount of framework lock-in. For example, they don't want to have to ship a library for React and another one for Vue and another one for bare bones JS/HTML.

In terms of building a web app where you control the environment end-to-end, I don't think there's any inherent upside to using Web Components over React.

discuss

order

dylanjha|1 year ago

(author from Mux here) -- that is correct. For the stuff we build for in-house use on mux.com and dashboard.mux.com we have a components library written in React.

You nailed it that we are shipping SDKs with visual components (like a video player) that need to be compatible across all kinds of frontends.

Instead of N number of SDKs to maintain where N is every front end framework, we have 2: a web component, and a React wrapper around the web component. Maybe in the (near) future we only have to maintain 1.

spartanatreyu|1 year ago

> I don't think there's any inherent upside to using Web Components over React.

The upside is that web components will last longer than react components.

There was a great blog post about this very thing and why someone chose them over react components in their use case (making their code migration-proof across updates and stack changes): https://jakelazaroff.com/words/web-components-will-outlive-y...

lmm|1 year ago

> The upside is that web components will last longer than react components.

How much are you betting? React components have been around longer and are more widely established, so personally I'd expect them to last longer.

danielrhodes|1 year ago

Your quote omits the qualifying part of that sentence, which is important. :-)

What does it mean to "last longer" when it comes to your own codebase? And why would web components help with that?

wokwokwok|1 year ago

They won't last longer than a react component (that's not even the claim the linked post is making); you can just use them in a different framework, if you care about that.

...which is the point the parent comment was making.

pier25|1 year ago

> I don't think there's any inherent upside to using Web Components over React.

What about using web components in a server rendered application without needing to resort to running JavaScript in the server?

junon|1 year ago

Yep, pretty much. They're a pain to develop for but worth it if you're writing libraries.