Live data from Hacker News

Web Components Eliminate JavaScript Framework Lock-In

jakelazaroff.com

131–140 of 300 posts

Re: Web Components Eliminate JavaScript Framework Lock-In

#131
post #6

One of the linked articles [1] makes an interesting claim that feels like a reach to me, but I'd be interested in hearing HN's take on it: > At this point React is legacy technology, like Angular. Lots of people are still using it, but nobody can quite remember why. The decision-makers in organisations who chose to build everything with React have long since left. People starting new projects who still decide to buil…

Fascinating that React simultaneously receives criticism as being 1) boring, old technology that has been around for so long that no one even remember why it was chosen in the first place, and 2) extremely fast-churning, bleeding edge software that is constantly changing and breaking because the JS community is more interested in chasing trends than building robust stuff.

Same people who say:

1) the ecosystem keeps chasing shiny tech that is constantly changing, not boring solutions

2) everything should be written in Rust

Re: Web Components Eliminate JavaScript Framework Lock-In

#132

Earlier quoted context omitted.

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 differ…

!!! 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.

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

#133

I haven't been in the frontend world for many years now, but I come from the mid-90's world of GUI development / game engines / old school desktop stuff. I look at this stuff, and just think how sad it is that we haven't progressed beyond the state of gluing together freakin low level divs and spans within some JS code with callbacks galore. For some reason I thought we'd have made it beyond that by 2023, and we coul…

It's a very complex problem to solve and I think a lot of people need to accept that. There will never be a simple solution with a low learning curve that's actually performant for non-trivial applications without a fundamental shift in browser technology.

There is. I was frustrated by all of the chaos and built a solution [1]. Not too far off from an RC1 and then a 1.0 (which is being done slowly so I can freeze APIs and avoid the typical JS rug pulls).

[1] https://github.com/cheatcode/joystick

Re: Web Components Eliminate JavaScript Framework Lock-In

#134

I like the idea of web components, but really dislike html and js being intermingled (the reason I don't like React/JSX). In web components its even worse because its HTML as a string which means it has no validation and isn't syntax aware. I much prefer the angular approach where you have separate css,html,ts files, and would love a web component framework that could work similarly. Searching for this I found some k…

I like React but I actually agree with you re: JSX, it helps me to remember that JSX is 'just javascript' - it's a syntactical shorthand for creating a component tree, which then happens to be rendered into HTML.

Re: Web Components Eliminate JavaScript Framework Lock-In

#135
post #6

One of the linked articles [1] makes an interesting claim that feels like a reach to me, but I'd be interested in hearing HN's take on it: > At this point React is legacy technology, like Angular. Lots of people are still using it, but nobody can quite remember why. The decision-makers in organisations who chose to build everything with React have long since left. People starting new projects who still decide to buil…

As someone who just had to answer this for my startup, the value of React is that it's robust and immensely hire-able. If you're looking for frontend developers, the one thing you can always expect is at least passable React knowledge. Everything else, even if it has a better technical fit for your project, is likely riskier for your organization.

I find this argument so absurd. If you know JavaScript and basic programming, you can use any front-end framework.

We're hyper-specializing people in a specific framework that then don't even understand the basics of JavaScript itself.

I already find the divide between frontend and backend developers unnecessary the majority of the time. This takes it a step further and in turn creates monstrosities like the leftpad debacle.

Can we stop with this nonsense? Hire good developers and let them spend 5 minutes to learn the god damn framework of the week. If your hire can't learn React in a week, I have some bad news for you.

Re: Web Components Eliminate JavaScript Framework Lock-In

#136
post #108

Earlier quoted context omitted.

Author here — I'm not sure what you mean by "lock you into one framework per component". The point is that you can encapsulate framework code within web components, not that every component you write should be a web component. Let's say you're writing a Vue app and you really want to use a library that's only available as a React component. You can wrap that library in a web component and use it in your Vue app just…

except you can't use it as a normal component, you can't adjust its CSS normally, you have to `&::part()` your way around and hope for the best. Accessing through refs is a complete blackbox. I work with web components daily and it is a hindrance to my daily work, it is very common for people at my org to just re-write a component instead of using its web component version.

I also wonder about this. The webcomponent make the style completely immutable unless you add part selector specifically… how on the earth this is even useful? Imagine using an ui library that you can't change the style at all. That sounds like a total joke to me. That isn't even a sane default that is useful to most web folks that make page base on layout that designers gave.

Re: Web Components Eliminate JavaScript Framework Lock-In

#137

Earlier quoted context omitted.

!!! 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.

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.

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

#138
post #39
post #6

One of the linked articles [1] makes an interesting claim that feels like a reach to me, but I'd be interested in hearing HN's take on it: > At this point React is legacy technology, like Angular. Lots of people are still using it, but nobody can quite remember why. The decision-makers in organisations who chose to build everything with React have long since left. People starting new projects who still decide to buil…

"Lots of people are still using it, but nobody can quite remember why." I can remember why. This, and every other article I've ever read arguing to replace React with Web Components, completely misunderstands the point of React. It isn't about JSX. It isn't about encapsulation. It isn't about reusability. It is about enabling a design pattern where *the user interface is a pure functional transformation of the applic…

> 4. Observables (Ember, maybe Angular 2+?)

Don't forget Knockout which was the OG. You can also make the case that Svelte, Vue, and Qwik all are different takes on Observables (at least as much as Angular 2+ is) all with more or less magic and more or fewer escape hatches from Observable best practices to imperative(-looking) code.

I got a "What if we did Knockout but with with the compile-time benefits of TSX and Pure RxJS Observables?" itch a couple months back and have made some wild progress on it. I certainly don't think it is ready yet to advocate as an alternative to React, but it's probably in an interesting A4+B2 tangent on your map right here, and I find that interesting.

Re: Web Components Eliminate JavaScript Framework Lock-In

#139

I've found webcomponents to be really good at encapsulating anything that doesn't directly query application state. Specifically there are two type of components that really thrive as web components (as opposed to react): 1. Highly interactive components - Components that implement complex interaction management (but sort of agnostic to application state) are ideal web components. You don't need to mess around with `…

> React conflates two concepts that I think are better when separated: templates, and components.

Whether a React code base conflates them depends on the code base, but the more familiar terminology is container vs presentation. [1]

[1] https://www.patterns.dev/react/presentational-container-patt...

Re: Web Components Eliminate JavaScript Framework Lock-In

#140
post #26

Earlier quoted context omitted.

> You don't need to mess around with `useEffect` or `useMemo`. You get really tight control of rendering and state updates. You don't need those in React either. Whatever you do in Web Components can probably (most likely) be done in React. After all, Web Components are a solidified 2010-era design. The reason React has hooks now because people have moved on, and are exploring other ways of building stuff. The only m…

> You don't need those in React either. I mean... sometimes you do, that's why they exist. But yeah, most of the time you don't. > Whatever you do in Web Components can probably (most likely) be done in React. Of course! React is a good and powerful framework. But everything you do in React can be done in Angular 1.0 or even backbone.js. As always with frameworks it's about the productivity / performance ratio for yo…

> I mean... sometimes you do, that's why they exist.

They exist because they're useful, but you can write traditional React components that look a lot closer to Web Components, if you think that's better.

Post reply on HN