Live data from Hacker News

React is winning by default and slowing innovation

lorenstew.art

521–530 of 866 posts

Re: React is winning by default and slowing innovation

#521
post #304

I've used React, Vue, Svelte and Solid. React is my far my least favourite of the four. Both before and after they added hooks, all the major API calls seem to have been designed for least intuitiveness. I really wish something else had won.

Which is your favorite, and why? :-)

I've stopped being interested in frontend frameworks after Vue/React but I agree. I find JSX with its mix of JS and HTML rather weird. I prefer Vue's abstractions and the readability of its template syntax. It's also rather easy to add it without a compilation step for some interactivity or app-like behaviour on a web page. More complex applications using a bundler work as well as our company is developing and maintaining a 100k LOC webapp too. In the end I'd prefer it if browser would provide a native API for two-way binding, components or templating and maybe state management as well.

Re: React is winning by default and slowing innovation

#522

What about Vue? How popular/good is it, in comparison to React?

Vue is in my opinion the clear winner of all the frameworks in most regards for complex applications. It is:

- mature

- stable

- with the new Vapor mode its performance rivals Svelte and Solid

- has a great ecosystem (Vue Router, Pinia, VueUse being the shining examples here)

- it's extremely simple, and doesn't come with any footguns unlike React. It's very hard to end up in weird reactivity hell situations in Vue like it is in React.

- the documentation IMO is world-class and far superior to React's (and yes I am including React's new docs, I think they're absolutely terrible)

- it's FOSS and permissively licensed, not backed or controlled by any VC or company like Meta or Vercel

Vue is actually the winner in East and SE Asia (especially in China, also partially because Evan You is Singaporean), it's just that React has the US in a bit of a stranglehold due to Meta.

Not to say it's perfect before someone jumps down my throat here, it has things I wish would improve. Namely the TS experience could be better especially in reference to events, and there is some baggage in the Composition API regarding the use of `ref` vs `reactive`, though even the docs themselves these days tell you to just stick to `ref` unless you really need a reason to use `reactive`. The tooling is also a bit annoying at times if you stick to latest Vue versions, especially since I use WebStorm which can be slow to adapt to some of its improvements (like the shorthand defineEmits syntax that was introduced in Vue 3.2, but intellisense for that in WebStorm only came around when Vue 3.5 was already released). These are my 3 biggest gripes with Vue at the moment, and to be honest I can't think of anything else as someone who is responsible for some very large Vue codebases.

Re: React is winning by default and slowing innovation

#523
post #519

Earlier quoted context omitted.

Hooks are very much not normal functions though. They are a new "colour" of function much like async functions - they can only be called in components or other hooks, they cannot be called conditionally, cannot be called in loops etc. The so-called "rules of hooks" (To get ahead of the common objection: of course it's still JavaScript by virtue of being implemented in JavaScript. But so are Svelte, Vue et all)

Surely they are not normal JavaScript functions, but at least the syntax itself is not turned into a DSL like we see it in Svelte or Vue. That is the main difference.

Yeah I get it. I don't think the "Just JavaScript" label can be applied to react anymore. It held in a class-based world. But it's not true post hooks.

I always hated templating languages

> Greenspun's {{rules.length | ordinal}} rule:

> Any sufficiently complicated templating language contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of the host language

But after working with Vue for a 18 months and expecting to hate it, I actually very much enjoyed it. The biggest downside is strictly one component per file.

Edit: in case I've come across as some kind of react hater, I was an early adopter and still use it professionally to this day

Re: React is winning by default and slowing innovation

#524
post #443

Earlier quoted context omitted.

I humbly disagree. I've never built a highly interactive application with React, only simple sites where the guys before me chose React, so I can't speak to its relative strengths or weaknesses there, but I've found that it doesn't scale down very well to simple sites. For a simple sign-in page, it's easy to just store state in the DOM and use a element to send the credentials, and maybe a little JS for the password…

You certainly don't need JSX for React, nor a build chain. My ship investor Kelly trainer game[1] is a simple React application in a single HTML file. The initial page load is slow because I experimented with using built-in browser module support to pull in React, but if you change it to serve a pre-built library from a CDN instead then also the initial page load is fast. You can view the source on that page to see h…

> 1. Import React. This is the step you can do from a CDN instead of you want a faster initial page load.

Using a CDN is very unlikely to get you a faster initial page load. Initialising an HTTPS connection to a new host is almost always going to take longer than serving that file first-party; there’s even a decent chance of this if your server is on the other side of the world.

Re: React is winning by default and slowing innovation

#525
post #438

React isn't winning by default. It's been so effective, so well designed that it's lived long enough to become the defacto standard... and the villian. Claiming React is slowing innovation is an absolutely bonkers take when React is essentially the only sane stable choice in a sea of "me too" frameworks and libraries with conflicting and confusing design choices.

Also react in particular in combination with tailwind seems to be easier for LLMs to generate. Probably due to the condensed syntax, no split between code, css and html, plus the color naming scheme of tailwind.

LLMs favour React and Tailwind because they’re popular, so they’ve seen a lot of them, not because of technical merit. This is the very manifestation of React winning by default and slowing innovation.

Re: React is winning by default and slowing innovation

#526
post #515

Earlier quoted context omitted.

So JSX is pure Javascript and not, say, a dialect of XML embedded in JS? Because it sure looks like the former even though it compiles to the latter. React isn't Javascript. It's a franken-language that looks superficially like a mix of JavaScript and XML whilst following the rules of neither. That's why there is such a thing as a React compiler - a good sign that you're not writing JS, which doesn't have compilers.…

JSX is just a syntax extension to JS, and it's not even required to create a React app. React "compiler" is in fact a transpiler, which is a very common thing in JS. >React is full of magic syntax that looks like functions Full of magic syntax meaning 5 straightforward hooks? Surely they are not true free-form JavaScript, but at least the syntax itself is not turned into a DSL

> 5 straightforward hooks

`useEffect` is straightforward? Cloudflare recently (like, literally 4 days ago)[1] had a pretty big outage because of the improper use of `useEffect` (surprise, surprise, it was the dependency array), a hook so infamous if you search "When should I use `useEffect`" you'll get approximately 9 trillion hits, with nearly all of them telling you something different, including Dan Abramov himself having to chip in with multiple blog posts telling people to NOT use it because of how much of a dumpster fire of a API it is.

[1] https://blog.cloudflare.com/deep-dive-into-cloudflares-sept-...

Re: React is winning by default and slowing innovation

#527
post #472

React isn’t just "winning by default" It's winning because at the core it's just JavaScript function composition. A component is a function, conditionals are `if (...) { ... } else { ... }`, loops are `map()`. JSX is just sugar for function calls. In Svelte you are writing XML with little JavaScript islands inside it. Instead of if you get `{#if}{:else}{/if}`. Thats not "ergonomic" – thats a mini-language stapled on…

So JSX is pure Javascript and not, say, a dialect of XML embedded in JS? Because it sure looks like the former even though it compiles to the latter. React isn't Javascript. It's a franken-language that looks superficially like a mix of JavaScript and XML whilst following the rules of neither. That's why there is such a thing as a React compiler - a good sign that you're not writing JS, which doesn't have compilers.…

um....react is literally js and its not a language, you can write react with or without jsx which is just syntax sugar to make it look more like html.

Re: React is winning by default and slowing innovation

#528
post #443

Earlier quoted context omitted.

You certainly don't need JSX for React, nor a build chain. My ship investor Kelly trainer game[1] is a simple React application in a single HTML file. The initial page load is slow because I experimented with using built-in browser module support to pull in React, but if you change it to serve a pre-built library from a CDN instead then also the initial page load is fast. You can view the source on that page to see h…

> 1. Import React. This is the step you can do from a CDN instead of you want a faster initial page load. Using a CDN is very unlikely to get you a faster initial page load. Initialising an HTTPS connection to a new host is almost always going to take longer than serving that file first-party; there’s even a decent chance of this if your server is on the other side of the world.

The problem in this case is not the HTTPS connection, but the fact that browsers, when importing ES6 modules, import all their transitive dependencies one by one. This means they can make a bazillion requests under the hood when importing just one library. A CDN is likely to have the library bundled and minified with its dependencies, turning those bazillion requests into a single one, which is much faster.

Re: React is winning by default and slowing innovation

#529

React isn't winning by default. It's been so effective, so well designed that it's lived long enough to become the defacto standard... and the villian. Claiming React is slowing innovation is an absolutely bonkers take when React is essentially the only sane stable choice in a sea of "me too" frameworks and libraries with conflicting and confusing design choices.

I humbly disagree. I've never built a highly interactive application with React, only simple sites where the guys before me chose React, so I can't speak to its relative strengths or weaknesses there, but I've found that it doesn't scale down very well to simple sites. For a simple sign-in page, it's easy to just store state in the DOM and use a element to send the credentials, and maybe a little JS for the password…

> only simple sites where the guys before me chose React, so I can't speak to its relative strengths or weaknesses there, but I've found that it doesn't scale down very well to simple sites.

I agree completely, my whole career I've been building webapps, as in like software that really couldn't be server side rendered, such as very interactive charting and table applications or games (that didn't require Canvas and could work in DOM but needed lots of reactivity, such as a SQL query builder game or a terminal emulator game), where react works decently. Vue worked fine and so did backbone/marionette, whatever, a framework is a framework is a framework, React has a lot of libraries I can just chuck in to get a date picker or whatever so I use it.

Anyway, I would never build anything that can be server-rendered in react. Simple forms, e-commerce, blogs, portfolios, anything like that I'm just writing in HTML or Django or Hugo or hell, Wordpress. I tried out Astro for a blog just to pick up the framework and didn't understand why on earth I needed all this insane boilerplate to render Markdown files. Hugo solved that problem. If I need more complex than that, Vite + react, done.

I feel like there's a lot of devs out there that are using react cause they like the devx "nice to haves" that they're used to e.g. hooks or whatever, when they really don't need them for their page.

Re: React is winning by default and slowing innovation

#530
post #472

React isn’t just "winning by default" It's winning because at the core it's just JavaScript function composition. A component is a function, conditionals are `if (...) { ... } else { ... }`, loops are `map()`. JSX is just sugar for function calls. In Svelte you are writing XML with little JavaScript islands inside it. Instead of if you get `{#if}{:else}{/if}`. Thats not "ergonomic" – thats a mini-language stapled on…

Hard agree. I've used xml directives before, all the way back to Macromedia Flex (which I believe borrowed form something in the Java space, which probably borrowed from something else).

I'll likely NEVER use anything that doesn't let me run JSX.

My personal preference is for complexity at the start of the render pipeline (e.g. in state) or at the end (e.g, in JSX).

So I personally dislike complex hooks composition, but I can live with it. (My) teams seem to like it. I'd rather have boilerplate of redux, or redux sagas - or a S.O.L.I.D framework + scaffolding tools, and turn the composition of logic part of my brain off.

But the context switch to maintaining scaffolding tools is perhaps a bit of a jump.

As an aside: I'm shocked to see Yeoman largely diminished in activity, and Hygen (https://github.com/jondot/hygen) not getting anywhere near enough love as it deserves etc.

Perhaps there is some, first-class macro or meta programming or combination of the two that is missing. Or maybe its hard to invest in tools you can't necessarily take from job to job - as scaffolding tools are capturing opinion.

Post reply on HN