Live data from Hacker News

React is winning by default and slowing innovation

lorenstew.art

401–410 of 866 posts

Re: React is winning by default and slowing innovation

#401

Web components are the way out of this trap. Every single framework that isn't React should be wholeheartedly supporting web components to make sure that they have access to a viable ecosystem of components and utilities without having to bootstrap an entire competitor to React and it's ecosystem. While a lot of people view web components as competitors to frameworks, they don't really have to be. The just define an…

Strong disagree. Web Components are react in different clothing. You don’t need this component-based framework style architecture to write applications for the browser. I promise writing applications for the browsers is not challenging. You don’t need big frameworks or component madness that’s more of the same.

React made reactivity popular. Web components don’t give you reactivity. You still tell the UI how to update based on state changes imperatively and that is annoying as hell.

If you want reactivity in web components, you need a wrapper or another framework/small library.

Re: React is winning by default and slowing innovation

#402

Earlier quoted context omitted.

Nope Lit.dev

I like lit. I'm not primarily a web developer and I've found it intuitive and easy to read and write. What I find more confusing than frameworks is building, bundling, ES modules, the whole NPM ecosystem.

>building, bundling, ES modules, the whole NPM ecosystem.

That's evolved hand in hand with the React monoculture over the past 10-15 years, maybe by way of a project called Babel.

Babel set out to provide progressive enhancement for the original ES5 to ES6 migration, and then in classic POSIWID fashion began to thrive on a suite of a la carte incompatibilities.

That experience is as much a contributor to the current automatism to to reach for (non-configurable) Prettier and Eslint, or more, than any rogue devs imposing fell coding styles.

So yeah, plenty of things in JS infra that look like they've been designed to be a pain in the ass (a.k.a. "behavioral nudge", towards TS, what else) and very much seem like the result of more inept moat-building in the then-newly ballooning field of frontend dev.

Readers might look up whan an import map is sometime, as well as where it is and isn't supported. How TS handled ES modules at the time Node16 changed their ESM support. Does ESM `default` correspond to CJS `module` or `module.exports`? Room for vendors to fuck up in innovative ways all round, this whole rotten ecosystem.

Readers are also advised to try Deno if they haven't yet. On Node, try Vite instead of Webpack. Most importantly, try Lit with JS, import map, no builder/bundler, and test suite with coverage. Work out what is most comfortable for you, work out exactly how much toolchain makes you the most productive, and afterwards don't forget to ask yourself why the React cultists want to stick everyone in a hairshirt if not a straitjacket.

Re: React is winning by default and slowing innovation

#403

Earlier quoted context omitted.

> the fact that you can only pass strings as attributes This isn't true at all though. It's a lie started in the early days by React engineers that just won't die, unfortunately. Web components are objects and they can have properties and accessors like any object. The vast majority of declarative template systems like React, Lit, Vue, Angular, Svelte, Solid, etc., will declaratively set properties - which can carry…

That approach passes values in JS rather than the DOM, right? I read the go comment as talking specifically about DOM attributes which can only be strings (well, you can have boolean attributes as well). Web components can be passed objects in JS, but its news to me if that is available in HTML.

I generally think the reflex to try to pass an object to an attribute on an element is a code-smell that the element hasn't been properly decomposed into sub-components. In those cases, I look more to adding child elements to represent those objects as an HTML serialization of the object.

Re: React is winning by default and slowing innovation

#404

Earlier quoted context omitted.

> I groan every single time I run into (yet another) hook rule. There are only two rules: 1. Only call Hooks at the top level 2. Only call Hooks from React functions Per https://react.dev/reference/rules/rules-of-hooks Not sure I understand the conditional beef, perhaps you can give example? I would assume if you want `if condition, useEffect(...)` you could simply replace with `useEffect(() => if condition...)`, no?

Fair. My bitching would've been better expressed as "I groan every single time I attempt to violate a hook rule." Which is a lot, because I'm new to React. It's almost certainly a "skill issue", but hooks are NOT just "JavaScript functions", contrary to React marketing PR. My conditional beef: in my app, users can choose between using the built-in mic for speech recognition or a 3rd party service (LiveKit). If the us…

You don't have to use their hooks! Looking at your pastebin link, I would probably opt for something like a factory pattern instead: https://pastebin.com/PbnBqX4a

Just because you're in React land doesn't mean you can't still write regular old js/ts and hook in only when you need it. I imagine you'd do something quite similar in any other framework.

Re: React is winning by default and slowing innovation

#405

Earlier quoted context omitted.

I have been a part of quite a few tech stack decisions at various companies and startups. I have literally never heard an argument made for react that included merits of the framework itself. The decision was always based on a combination for familiarity, ability to hire for eng roles, and the ecosystem.

Then why dont you pick jquery? Its easy and well known, even now. The answer I see is that react is technically good enough. Using boring technology doesnt mean using the technically most advanced thing. It means picking something safe and stable.

React is significantly more easier to hire for than JQuery is, especially in this market. Especially if you’re looking for more junior roles.

As a new grad, I would’ve picked a react job over a JQuery job even if the JQuery one paid me 10k more.

Re: React is winning by default and slowing innovation

#406
Switching to Svelte could be a massive W for a small organization, they'll get inundated with a flood of highly motivated, skilled ex-React developers. Also if react is as probablamitc as people say (I'm veteran of the Angular/Angular.js transition wars so i don't know whats going on as much). If svelt et co. it helps a business not only achieve greater speed but maintenability long-run it's a competative advantage and should be exploited. much like how legacy c code is being handled due to its memory unsafeness. Would that happen?

Last tidbit Web Components are often suggested as a solution, they could lead to another layer of complexity. For instance, how do we manage complex, shared state across different web components that might be built with different tools like Lit or Stencil? How do components built by different systems pass information to each other without essentially creating an ad-hoc framework on top of the web components standard?

Re: React is winning by default and slowing innovation

#407
One consideration that that is missing: how familiar are LLMs with this technology? And from this point of view the app has sailed, I’m afraid we are stuck with the frameworks that are available today for eternity, for better or worse. And maybe that is not such a bad thing. I don’t do full stack programming in my day job, but I have this crazy idea that if I ever have a startup idea, I want to be able to code an MVP. So, every two years I do a deep dive and write a toy web app. I’m always learning something new on the frontend (fun!), while on the backend I just use Django, so it just works as it used to, except it usually gets more convenient in many small ways (boring). Sometimes there’s such a thing as too much fun.

Re: React is winning by default and slowing innovation

#409

Web components are the way out of this trap. Every single framework that isn't React should be wholeheartedly supporting web components to make sure that they have access to a viable ecosystem of components and utilities without having to bootstrap an entire competitor to React and it's ecosystem. While a lot of people view web components as competitors to frameworks, they don't really have to be. The just define an…

I moved my entire business off React and now I don’t have to worry about tinkerers at Meta deciding to reinvent React every 2 years and tricking everyone by keeping the name again and again. Web components are fantastic. They are the real future.

Apart from classes -> hooks what big changes have happened?
Post reply on HN