4 ms·
This is slightly off-tangent, but as someone who has written production software on the front-end (small part of what I do/have done) in: Vanilla -> jQuery ->
by gavinray 7y ago
This is slightly off-tangent, but as someone who has written production software on the front-end (small part of what I do/have done) in:
Vanilla -> jQuery -> Angular.js -> Angular 2+, React pre-Redux existence -> modern React -> Vue (and hobby apps in Svelte + bunch of random stuff: Mithril, Hyperapp, etc)
I have something to say on the topic of:
> "If you pick React, you're not getting hurt because Vue and React are incompatible, you're getting hurt because the React shit breaks and churns."
I find the fact that front-end has a fragmented ecosystem due to different frameworks completely absurd. We have Webcomponents, which are framework-agnostic and will run in vanilla JS/HTML and nobody bothers to use them.
Most frameworks support compiling components to Webcomponents out-of-the-box (React excepted, big surprise).
https://angular.io/guide/elements https://angular.io/guide/elements
https://cli.vuejs.org/guide/build-targets.html#web-component https://cli.vuejs.org/guide/build-targets.html#web-component
https://svelte.dev/docs#Custom_element_API https://svelte.dev/docs#Custom_element_API
If you are the author of a major UI component (or library of components), why would you purposefully choose to restrict your package to your framework's ecosystem. The amount of work it takes to publish a component that works in a static index.html page with your UI component loaded through a <script> tag is trivial for most frameworks.
I can't tell people how to live their lives, and not to be a choosy beggar, but if you build great tooling, don't you want as many people to be able to use it as possible?
Frameworks don't have to be a limiting factor, we have a spec for agnostic UI components that are interoperable, just nobody bothers to use them and it's infuriating.
You shouldn't have to hope that the person who built the best "Component for X" did it your framework-of-choice (which will probably not be around in 2-3 years anyways, or have changed so much it doesn't run anymore unless updated)
---
Footnote: The Ionic team built a framework for the singular purpose of making framework-agnostic UI elements that work with everything, and it's actually pretty cool. It's primarily used for design systems in larger organizations and cross-framework components. They list Apple, Microsoft, and Amazon as some of the people using it in production:
https://stenciljs.com/ https://stenciljs.com/
- throwanem 7y agoWeb components aren't really there yet. They will be two or three years from now. Some time between now and then, I expect React will gain the ability to compile down to them, which shouldn't be too hard since web components are pretty much what happens when the React model gets pulled into core.
- acemarke 7y agoVery unlikely. Web components and React are trying to solve different problems, and the React team has repeatedly said this isn't going to happen.
- gavinray 7y agoYou can compile React to Webcomponents with community tooling, the core framework just doesn't support them: https://github.com/adobe/react-webcomponent https://github.com/adobe/react-webcomponent By "aren't really there yet", what do you mean? If you mean in a sense of public adoption and awareness, totally agree. If you mean that they don't work properly, heartily disagree. They function just as well as custom components in any framework, without the problem of being vendor-locked. You may not be able to dig in to the internals of the component as well as you would a custom build one in your framework-of-choice, but that's largely the same as using any pre-built UI component. You get access to whatever API the author decides to surface for interacting with it. A properly built Webcomponent is generally indistinguishable from consuming any other pre-built UI component in any other framework (Ionic built a multi-million dollar business of off this alone, and a purpose-built framework for it).
- bandrami 7y ago> nobody bothers to use them Here's the sad but unavoidable truth: the main purpose of Javascript currently is to keep Javascript developers employed.
- throwanem 7y agoSpoken like someone who's never seen what people perpetrate in, say, Java.
- gear54rus 7y agoNo one uses them because SSR is either non-existent or clunky with them. Ignoring a common use case when inventing something is a good way to get your shit ignored in turn. Which is what happened.