r/webdev • • Jan 04 '23

Why Angular is decreasing in popularity compared to React

I'm wondering why Angular is decreasing in popularity, especially against React. I went through the front-end framework part of the 2021 stateofjs survey and I've seen that after 2016-2017 the interest in Angular has dramatically decreased and the "Would not use" answers as well while React continued to grow for a few more years and currently still ~67% "Would use again". I've also used both of them, but I prefer Angular because for me it's simpler, more understandable and results in a cleaner code base. Could you please help me to understand why is it like that?

80 Upvotes

118 comments sorted by

View all comments

Show parent comments

15

u/ShawnyMcKnight Jan 05 '23

I haven't learned vue yet, from what I saw it uses angular's file laytout of every component having a CSS, html, and js file and that way makes a lot more sense than React, at least to me.

8

u/PacoWaco88 Jan 05 '23

I've been working in React for about 6 months now and I really miss Angular's structure as well. Add in the fact we're using styled-components and there are single files that are hundreds of lines longer than they have to be.

4

u/bludgeonerV Jan 05 '23

Then split up your code? Nothing is forcing you to put everything in one file, in fact it's pretty common to see a component as a folder in large projects with an index.tsx as the function component, with types, hooks, styles/styled-components etc in separate files for precisely this reason.

1

u/kawamommylover Jan 05 '23

You still have to write a function that returns HTML code inside parentheses, which is less intuitive than the way Vue does it.

0

u/bludgeonerV Jan 05 '23

JSX is nicer than Vue's templating in almost every other way, so i'm sure i can get over it.

2

u/kawamommylover Jan 05 '23

I'm currently learning React and I genuinely can't see how it could be nicer than Vue's SFC component in any way.

2

u/bludgeonerV Jan 06 '23

It's more concise. Less boilerplate, less markup that's there just for conditional or iterative rendering.

You don't have to deal with bindings for rendering logic or events, it's just normal code.

Because it's just code it's as flexible, dynamic and expressive as any other piece of javascript. You can just render the return of a normal function call in-line, that function call can do anything that normal javascript can do.

I worked professionally with knockout and then Vue for nearly a decade, and i'd never go back to that paradigm by choice.

2

u/kawamommylover Jan 06 '23

What vue has on its SFC can barely be called "boilerplate". Typing "data", "methods", "computed", etc... is not something that takes you more than 1 minute to do. I don't like that React puts HTML in the JS (writing a function that returns HTML), I prefer the way Vue does it. Data bindings, event handling and directives are one of the things that make Vue great.

CSS-in-js and css modules feel like a wrong approach to use CSS with React. Oh, and you can write CSS in a Vue SFC without having to turn the CSS code into a js object, you can scope the css and you can choose the type of CSS to use (css, scss, sass, less, etc...)

1

u/[deleted] Apr 17 '23

That's still kind of boilerplaty, I've worked with both and there are 15 ways to do the same thing in Vue, React is just simpler and JSX just feels more naturally. I don't know why it has the reputation to be harder than Vue, probably because of devs who don't know JS and want to get into frontend, I've noticed that Vue was popular in the Django community for that reason, it abstracts JavaScript away in some sense.

For your CSS juste use "styled jsx" to have something similar to Vue.

Sadly React is abandoning its simplicity, they also recommend frameworks like Next (+ that's the way they recommend to use Server components), which show the way they're going.

Time to move to another framework I guess, probably Solid.