Hacker News new | ask | show | jobs
by jrajav 1062 days ago
React is now the de facto choice and much less painful than past de facto choices, is my take on why. It has a mature and healthy ecosystem, and its relatively small surface makes it easy to learn and predictable, while declarative GUI in general is low on footguns compared to ye ol two-way data binding.

Many of the competitors springing up define themselves in terms of React, either as an improvement or a foil. But if you're just trying to get things done, it's hard to go wrong with it - and in a practical sense, not a "nobody got fired" sense.

6 comments

React doesn't have a "relatively small surface" any more, because even the React team doesn't recommend that you use "just" React. It's all frameworks on top of React like Next or Remix, and those are more complex, have many involved concepts and come with footguns. I have seen many, many sites switch to Next and completely bungle it, making the user experience worse than it was before the change.

(Of course, even React itself has gotten fairly complex with Hooks, Suspense and the dreaded Server Components.)

> I have seen many, many sites switch to Next and completely bungle it, making the user experience worse than it was before the change.

What are some specific sites you've seen that adopted react and ended up worse as a result of it?

> doesn't have a "relatively small surface" any more, because even the React team doesn't recommend that you use "just" React

Isn't this evidence of it having a relatively small surface area that frameworks and other tools can build on top of, much like html, css etc?

> Isn't this evidence of it having a relatively small surface area that frameworks and other tools can build on top of, much like html, css etc?

No? You can build on top of a large surface area, too? Of course, the funny thing is, even if you are right and React has a "relatively small surface area" (relative being the operative word,) what good is it when the creators of the framework say that you shouldn't use that surface area directly?

> What are some specific sites you've seen that adopted react and ended up worse as a result of it?

I don't think you're arguing in very good faith, but one recent example is the Indian grocery delivery service bigbasket. They switched from mostly-server-rendered to Next, and the new version was downright horrid for a while, and is only barely usable now. The most cruel part of the joke is that the next.js version is currently only shown to logged in users, so you can blissfully shop for a while, get to the cart and then be hit with the awful new UI.

Another example is new reddit
You can still use just React. No one is forcing you to use Next or Remix
No one is forcing you, but the React docs say "If you want to build a new app or a new website fully with React, we recommend picking one of the React-powered frameworks popular in the community. Frameworks provide features that most apps and sites eventually need, including routing, data fetching, and generating HTML."

So, it going to be difficult to choose pure React with that kind of statement.

Even using React v5 without a state library for a large app was bonkers back then, regardless of what the library maintainers said.

At some point you will have some state that transcends the UI and trying to shove it into React UI component does not make sense.

How is it difficult? Tons of companies have profitable UIs that aren't using a meta framework. Just because the React team says "we recommend you do X" doesn't mean you have to do X. If they said, "you must do X" then yea, you should do X
I remember hearing exactly the same words about jQuery a decade ago. This is bias stacked on comfort using a bandwagon mythology as a qualifier.
Jquery worked for a world that was mostly html with some sticking a of JavaScript. In fact, it still does.

React is just a better approach to building all-encompassing SPAs.

haha, I basically feel this way about Svelte/Kit. It's not mature, but the surface is so small and learning curve so pleasant that it's our go to choice now for internal webapps.

(We have no external webapps because my company, funny enough, builds a JavaScript framework!)

> not mature

Svelte was first released in 2016 and has become bigger than its original creator, Rich Harris. It has quite a thriving ecosystem and a big community. The tooling around it is more mature than React's has ever been.

> surface is so small

I actually find the opposite to be true. React still has a relatively small API surface area. One-way data flow makes it easier to understand. However, a smaller surface means arguably less expressivity, so I think Svelte's bigger learning curve is worth it. You can learn about 90% of React in a weekend and be productive. You can learn about 20% of Svelte in a weekend and also be somewhat productive, but you need to learn about 60-70% more to use Svelte as it's intended, rather than as a React alternative.

I think Svelte has a much smaller learning curve, personally. If you know Javascript there's hardly anything to learn.
This is wrong in so many levels. You need to learn useState,useEffects in react.

You only need to learn how to put {varName} in svelte.

useState and useEffect are quite simple small elegant API. It does not mean it's very easy to use for newbie. Maybe like Lisp?
Oh sure, useState and useEffect are very simple. Your app built upon them, on the other hand…
You don't need to learn useEffect until you need to plug arbitrary js libs and components into react. That's the intended use of useEffect. Using it for anything else is usually a bad idea.
How can you "fetch something when your state change ?". It's the main use case for useEffect.
You can just trigger fetch in the function that does the state change.
How is Svelte intended to be used that is so hard to learn?
I'm not a web dev anymore, I stopped right around the time hooks became a thing in React, and while Svelte was an exciting technology no big players had adopted yet. In fact the last thing I did for my old job was a little make-work exploration to test whether Svelte was was ready for them to use in prime time. My conclusion was that it was remarkably slick and empowering, but was not ready yet due to the lack of ecosystem support. It's cool that Svelte and its community has continued to grow to the point where it is a legitimate contender. I'll be honest, I never liked React very much and would love to see it dethroned, even though I have almost no stake in that anymore!
I’ve been working with Svelte very heavily since November of last year. It’s been a real journey with Svelte and SvelteKit over the last 7 months, seeing things change rapidly. I think one of the coolest things is that it has galvanized frameworks to become SPA framework agnostic.

Like NextAuth.js -> Auth.js React Query -> Tanstack Query

So at the very least, I think we are probably headed towards a plurality where it is practical to use Vue, React, Svelte or Solid though I do hope Svelte “wins” in the end.

I have to say, I still don’t think it’s to the point where it can be foisted on a team of mediocre developers in some kind of enterprise setting. Some of the libraries that exist for SvelteKit that I consider super critical are very small and maintained by one or two people.

I recently took on some freelance work for the first time in like 6 years, just to work on another large SK codebase and saw a lot of the same problems I encountered approached differently. I think there’s some key things that need to make it into core still.

> lack of ecosystem support

.. is the “Nobody Got Fired For Buying (IBM|Microsoft|Cisco)” for the 2020s

How's Svelte different from AngularJS 1? I have such bad memories that I refuse to touch any code-in-html framework with a 10 foot pole.
https://component-party.dev/

Long-time Java dev by background, used more frameworks than I could possibly list. I won't touch React with a ten foot pole.

SvelteKit is the first web framework I ever used that I enjoy working with.

Doesn't sound like a very promising company if your own developers rather use a different framework than dogfood their own. Isn't that kind of admitting defeat?
We develop and sell a visual Diagramming library, not an SPA framework. There is no overlap.
Hold that thought. Many people are saying React has jumped the shark with the complexity of server components and tight coupling with favored frameworks like Next.js

I wouldn't be surprised to see some movement toward simpler but equally robust frameworks like Vue or Svelte.

Or SolidJS which uses Signals.
I actually really enjoyed programming with Qt in C++ using "signals and slots," about ten years ago for a school project. Perhaps it was ahead of its time.
I believe WordPress choosing React as its frontend framework of choice further solidified this point.
> React is now the de facto choice

I contract for a few companies and everyone seems to have a different take on the industry standard.

React may well be biggest, but I don't think it's possible dominance is the reason there are fewer framework posts on HN recently.