A sentence written by someone who clearly hasn't worked on a large Angular 1.x project.
A sentence written by someone who clearly hasn't worked on a large Angular 1.x project.
React didn't win by default, it won because developers tried it and found it was better. It absolutely won on technical merit.
There's a bit of a question of whether React would still win on technical merit today, versus all the next-generation frameworks. I personally think it is still better than Svelte, Vue, etc, but I'm a bit of a React apologist.
Meteor was node framework. jQuery is probably still more popular but it is only a lib. Vue had a Chinese language problem.
React won because a framework by Facebook felt safe.
Products rarely win because of technical merits. Products win with marketing. Technical merits can add another layer to the marketing but without facebook's brand people would still be on angular.
The short answer is that what you're asking doesn't really make sense to me. I think of the lifetime of state as analogous to member variables of a class. In the same way that member variables in a class are always visible to the entire class, a state variable in React is always visible to the entire component. You wouldn't want it to be scoped to an if block any more than you'd want a member variable to be scoped to an if block.
Maybe now you're thinking "well, that's limited in an annoying way, and Svelte is better". Maybe. But I suspect for any problem that exists that you think needs conditionally-scoped state, there's a nice clean solution in React. That's what I suspect, anyways. But I very rarely run into problems in React that I can't express in nice, clean code.
Don't forget about having a migration path. I don't know how common it was (or how messy it might be, I never did this myself), but before Redux became popular, people were using Backbone models as the datastore for React. So existing Backbone-based apps had a way to piecemeal migrate to React.
* Two-way data binding spaghetti
* Boilerplate-heavy reactivity
* Opaque, framework-specific magic
* Manual state updates/transitions
React didn't win "by default" (whatever that means), it won because it was better than most of the other options at the time.
I agree that, on purely technical grounds, it isn't as strong of a framework as other competitors anymore, but React is and has always been Good Enough™ for most companies, to the point that it's not worth reaching for anything else most of the time. And I say this as someone who doesn't like most things about modern React.
I am so glad to be old and have lived through the transition from Angular to React. To understand why we have React. In fact I am so old I have lived through the transition from Adobe Flex to Javascript Frameworks first.
And the thing that is clear to me is that wave of Javascript Frameworks, of which Angular was one, looked at Flex and leanred all the wrong lessons (I'm looking at you two-way data binding) whilst React got second mover advantage and learnt all the right lessons.
I've worked on 2x, if not 3x larger React codebase without these issues. I can't tell a single instance where language tooling was failing me so severely that I've contemplated turning it off because it's creating more uncertainty than its helping.
I'm relatively new to Angular 20 itself—only used Angular 1, and also migrated that project to React. So I'm not yet qualified to make big statements about it (but a preliminary gut feeling is that it often feels complex in the wrong places). C'est la vie though
Fun times.
That was in 2013. Angular 2 came out in 2016, and by that point React had won. Have had to dabble in other frameworks since then, and none of them seem to do anything significantly better than React. I spent my early career learning a new FE framework every year, at this point I'm happy to have something boring that does what I need and has a great ecosystem around it.
React’s main benefit wasn’t technical, it was organisational. It’s so opinionated that it’s difficult for an incompetent developer to introduce very low quality code into the project. Meanwhile in AngularJS, a developer with a clever implementation idea was a terrifying prospect for future productivity.
One of the biggest criticisms at the time (And perhaps still now) was that it wasn't opinionated at all. It didn't make assumptions as to how to do routing, or to fetch data, or to handle state. The community eventually converged towards a handful of solutions, like redux, but it was easy for each project to have its own combination of flavours and patterns.
Angular was an all-batteries-included MVC framework, with DI, testing framework, and one true way to do things. The reason why it's harder to introduce very low quality code in React is because React is just functions, returning JSX, executing when the function parameters change.
On the other hand, angular had comically large footguns due to its very high complexity. Have a look at the legacy documentation, the page about "scopes" by itself is longer and introduces more concepts than the entire "Thinking in react" page.
> Angular was an all-batteries-included MVC framework
As said back then, React is just the "V" in "MVC".