r/angularjs • • Jun 30 '18

Why React is bad.

Here's why I think Angular is much better than React for creating SPAs.

React is not a framework like Angular is. It doesn't provide a comprehensive, one stop solution for all the things that you need for building an SPA. Often you will hear that React is 'un-opinionated' and that it allows developers the freedom to use whatever technologies they want alongside it. In practise, this means having to either constantly reinvent the wheel, or else employ a hotchpotch of third party libraries and be completely at the mercy of their maintainers.

Third party libraries may be buggy and there's no guarantee that fixes will be swift, if they even happen at all. Plus, they may be deprecated without any notice and you have to hope that they will work together successfully.

For state management Redux is the defacto standard. Redux is, in my view, seriously flawed. Firstly, why do you need to have a store in your client side at all? Is that not what the Database is for? In an SPA, the URL should be the single source of truth and the entire state of the app should be derived from this, using data fetched from a service. When you use Redux in an SPA, you need to work to keep the store in sync with the URL. This is a lot of work for no obvious benefit.

Another problem is that it risks storing stale data. Once the URL changes, all the existing data is potentially stale. There is no value in storing data across requests. If you want to cache data, the browser will cache your requests. Invalidating caches is notoriously difficult to do - why on earth do we bring this problem to client side development!

Redux also introduces Race conditions. If we make multiple requests to the server in quick succession, the Redux store has no way of knowing in what order these were made and given that they can return in any order, it is quite possible that the page we are looking at could be overwritten by the data from an old request! More detail about this problem here:http://blog.richardhunter.co.uk/index.php/13

The Redux store does NOT represent the current state of your app. It probably contains it, but it contains an awful lot besides and working out what is the current state and what is old state involves a lot of error prone work.

The next problem with React is that it does not support Dependency Injection. https://en.wikipedia.org/wiki/Dependency_injection DI is essential for building a complex enterprise grade application. The main benefits of DI are that it makes object creation a much cleaner process and it decouples dependencies from their implementation. If the last point is unclear, what it means that when you build an object you can supply completely different objects for any particular dependency. This is useful in testing where you can swap in mock objects for dependencies and thus test your objects in isolation from each other. With React, you have to rely on monkey patching or else test much larger chunks of your code at a time.

In React, you have to pass any dependencies down to components through props which can mean that a component has props that it doesn't actually use itself but just has them so it can pass them down to child components. You can use the Context for surfacing dependencies in a component but this is very much a poor man's DI imho.

There are other things about React that I don't like, but I don't want to extend this post too much. In particular PropTypes seem like an extremely feeble way of doing static typing and really typifies what is bad about React.

React isn't just different for not being a framework - it's worse. It is hopelessly inadequate for doing the job that it is supposed to and just results in messy, buggy, and inadequately tested applications.

I think the reason that React is more popular than Angular is because Angular lost a lot of good will during the shift from version 1 to 2. Maybe the Angular team didn't cover itself in glory, but I think the decision was the right one as the new Angular is much superior to the old one. It's irrational to dislike Angular because of these events but maybe a lot of developers are irrational.

0 Upvotes

122 comments sorted by

25

u/prof_hobart Jun 30 '18

Firstly, why do you need to have a store in your client side at all? Is that not what the Database is for?

A client-side cache is there to improve performance - faster client responses, less server load and less fragile to intermittent networks. If you don't need any of that, you possibly don't need a client cache. There's absolutely nothing in React's structure that prevents you pulling the required state from the server on ever page navigation. And there's nothing to stop you using the browser cache if that's what you want to do. But that's a lot more complex than simply building up a client-side model of the data your app needs.

If we make multiple requests to the server in quick succession, the Redux store has no way of knowing in what order these were made and given that they can return in any order, it is quite possible that the page we are looking at could be overwritten by the data from an old request!

If you're doing multiple async calls at the same time that can return contradictory data, then yes this is something you're going to deal with. But I'm not sure how that's got anything to do with React - it's been true as long as I've been working on async. There's things that you can do to help, but again mostly nothing language-specific, such as

  • redesign your system so that you don't have this possibility (it's the kind of thing that backend-for-frontend orchestration tiers are there to help with - create a single server-side endpoint that pulls data from multiple sources and returns it in one go)

  • have your client-side logic know which data should take precedent, whether based on which call it was, what the timestamp of the call was, or something else

  • wait for call A to come back before kicking off call B

There's things that libraries can help with (redux-saga, for instance, makes some of the coordination easier), but fundamentally these are just basic problems of asynchronous traffic - if you do two simultaneous calls, you've got no direct control over what order they'll come back in. Or is there something magical that Angular does to make this go away?

working out what is the current state and what is old state involves a lot of error prone work.

Don't understand what you mean. If you're designed your model badly, or don't understand the nature of your server interactions, then yes you're going to have problems. But in a well-designed app, this is one of the things that Redux makes ridiculously easy - take the current state and apply a transformation to it based on the most recent action and produce a new state. It's basically functional programming, making it easy to both reason about and test.

In React, you have to pass any dependencies down to components through props which can mean that a component has props that it doesn't actually use itself but just has them so it can pass them down to child components.

This is one of the other things that Redux makes very easy - at the appropriate point in your component hierarchy, pull out the bits of state (and potential actions) that it needs to worry about and pass them as params.

The next problem with React is that it does not support Dependency Injection

It doesn't have a whole framework around dependency injection, no. But there's nothing stopping you simply injecting your dependencies through parameters if that's what you want to do.

There's plenty of problems with React. But most of these seem little to do with React at all and the ones that do seem to be based on a flawed understanding of what it provides.

2

u/[deleted] Jun 30 '18

There's things that libraries can help with (redux-saga, for instance, makes some of the coordination easier), but fundamentally these are just basic problems of asynchronous traffic - if you do two simultaneous calls, you've got no direct control over what order they'll come back in. Or is there something magical that Angular does to make this go away?

Yes. What you need to do is to cancel the old request. This you can do using Observables and using switchMap in particular. Observables are tightly integrated with Angular and this approach is recommended in Angular's documentation. https://angular.io/guide/router

3

u/prof_hobart Jun 30 '18

Oh right - I thought you meant three separate calls, where you need data from each one, but some of them could have contradictory data.

If you're after cancelation, then your HTTP client (e.g. Axios, which is a fairly common one for React apps), will probably support it. And again, redux-middleware, and especially redux-saga, make it very easy to know when to do the cancelation.

1

u/[deleted] Jun 30 '18

I haven't used sagas but I believe they are something similar to Redux Observable's epics, which is what I do use to solve this problem. But again, it's extra code to solve the bugs in Redux.

6

u/prof_hobart Jun 30 '18

What bugs? Redux-saga isn't attempting to fix any bugs in Redux. It's adding functionality on top of Redux, but that's a very different thing.

And no, sagas aren't observables. There are observable libraries available though - if you want to sit on top of React (with or without Redux) - as React is not opinionated about these things, it's usually fairly easy to find a library that gives you whatever option you want.

If you don't want that flexibility, and want to have an out of the box full framework that saves you having to think about a million different ways of doing things, then Angular is a great option.

But opinionated vs unopinionated doesn't make one of them brilliant and the other terrible - it means that they are there to appeal to different audiences.

1

u/[deleted] Jun 30 '18

I never said sagas were observables, I said I thought they were similar. I'm using observables because I discovered problems with Redux. Code that fixes problems is a bug-fix.

9

u/prof_hobart Jun 30 '18

In what way do you think they are similar?

Code that fixes bugs is a bug fix. If the thing was never meant to do what you're trying to do with it, that's not a bug. I don't use Chrome to fix a "bug" in Word that it can't browse web pages, for example.

1

u/[deleted] Jun 30 '18

But in a well-designed app, this is one of the things that Redux makes ridiculously easy - take the current state and apply a transformation to it based on the most recent action and produce a new state. It's basically functional programming, making it easy to both reason about and test.

The Redux store does NOT represent the state of the app. It contains whatever the application happens to have put into it during the entire lifetime of the application. The should contain the state, but it likely includes a lot more besides. What is the value of all this stale data lurking around? Why should a developer have to worry about this at all?

7

u/prof_hobart Jun 30 '18

Still not understanding what you're meaning. What stale data? If you put data in that's not relevant, then yes you'll have irrelevant data in there. If you don't, then you don't.

I've been working with Redux on several apps for the past year and at no point have I looked at a bit of state and thought "why is that still there?"

4

u/[deleted] Jun 30 '18

The actual state of an application is represented by the URL not by the store. If you want the store to be in sync with that then you need to write code to make it so. It doesn't happen automatically. That means there is a potential for stale data to remain in the store and cause bugs.

6

u/prof_hobart Jun 30 '18

The URL represents some element of the state, but doesn't contain all of it. It might tell you that you're looking at customer 123, but usually won't contain their name and address for example. That needs to live somewhere.

If you don't want that to persist between navigations, then you don't need to - nothing in React is making you persist it.

If you do want to persist it - maybe its slowly changing data, or slow/costly to keep pulling back every time someone clicks back/forward - then it needs to be stored temporarily in the client. That's not a React/Redux thing - that's just a fact of client apps.

Redux makes managing that, if it's a thing you want to do, fairly straightforward.

-1

u/[deleted] Jun 30 '18

No, the URL DOES represent the entirety of the state. It does NOT contain all the data, obviously - Just as a digest represents the entirety of the data that it is calculated on. A web page should be bookmarkable and completely reconstructed from the stored URL. The data itself normally comes from the server. When the URL changes, that data is potentially all stale. I fail to see the value in having a store for keeping that around.

7

u/prof_hobart Jun 30 '18

What do you think React does to stop you building your app in that way if you want?

I fail to see the value in having a store for keeping that around.

What happens when your server can't be reached? Or the user is just clicking back/forward constantly? Do you keep calling the server every time?

What if you've pulled back data that's not going to be changing during a session (a list of last months financial transaction for example)? What if you have a large data set and you just want to deal with updates?

1

u/[deleted] Jun 30 '18

I'd use a service worker.

7

u/prof_hobart Jun 30 '18

Something you could chose to use in React if you wanted.

You'd then presumably be caching client-side?

0

u/joesb Jul 01 '18

You sounds like some manager who has just heard a new hot word and think it is magic.

1

u/sinefine Jul 01 '18

You are not canceling the old request. You are canceling the old request HANDLERS. There's a big difference. You are still making http requests.

7

u/[deleted] Jun 30 '18

[removed] — view removed comment

1

u/[deleted] Jul 01 '18

This would be my preference too and is possible. The problem is that Redux is necessary if you want to do server side rendering. The reason for this is that without Redux, when you renderToString on the server, all you get is the basic view without any data. You need Redux to hydrate the app with data before rendering it.

This means that in your app you now have the overhead of keeping the store in sync with your state for reasons unrelated to client side functionality.

Since I do want to still use rxjs, I use redux-observable https://github.com/redux-observable/redux-observable It does the job, but now I have 3 different ways of handling actions: in the reducers, in middle ware, and in epics, which seems somewhat inelegant to me.

2

u/bel9708 Jul 03 '18

You don't need redux for SSR...

0

u/[deleted] Jul 03 '18

Not absolutely, but it helps.

1

u/bel9708 Jul 03 '18 edited Jul 03 '18

It really doesn't. It's more difficult to hydrate with redux as opposed to just passing state in as props.

3

u/[deleted] Jul 03 '18

This implies that all state comes from the top and flows down (Which is effectively what you get with Redux), but state can also be isolated within nested components. How do you hydrate those?

3

u/cyberbeast7 Jul 01 '18

Thank you for constructing that reply. Reading the OP made my blood boil due to the flawed understanding of the different aspects of an SPA.

2

u/prof_hobart Jul 01 '18

As I got further into discussion with him, it got comically clear just how little he understood about some of the basics of web development full stop.

He'd clearly at some point written some React/Redux app that had some major bugs in, and he was desperate to blame those bugs on those libraries rather than his complete lack of understanding of them and the basics of async development.

If you follow the rest of the discussion, he failed to understand web security, how JavaScript processes data, the difference between dev and production builds, how routing works in React, what his responsibilities were as a dev, or how to have a civil discussion.

-3

u/[deleted] Jun 30 '18

And there's nothing to stop you using the browser cache if that's what you want to do. But that's a lot more complex than simply building up a client-side model of the data your app needs.

Using the browser cache requires 0 code on the client side: it just works.

6

u/e-freak Jun 30 '18

Except it doesn't. Especially when you add caching headers to your API endpoint's you will get problems sooner or later. I've worked a while with react and redux but switched to angular (again) because it fits my usecase a whole lot better. React and angular have different use cases. When you want to build a real spa angular (or Vue, elm etc) is the way to go. But with react because you don't have a huge framework you can replace small parts of your existing page with react components.

And regarding your problems with redux, it sounds like you don't have a well designed store and you're focused to much on the URL as single source of truth aspect.

I'm using angular with ngrx, which is the equivalent of redux & redux-saga but for angular and I don't have any problems with it whatsoever. When you have an edit page for some data e.g. a profile page you can update the store as soon as the user hits save and let the request run in the background. If it fails you can simply undo your last change (you could hold the old state until the request finishes or create a diff or whatever). This is entirely possible without the redux concept, but it makes it a whole lot easier to test and debug.

0

u/[deleted] Jun 30 '18

Thanks for the response but could you explain what problems adding caching headers to API endpoints will bring that caching the same data in Redux doesn't?

1

u/e-freak Jun 30 '18

When your API endpoint's don't have any caching headers you can just do the same request again and get the latest value. This applies when you refresh the page or you add a manual refresh button which calls the endpoint again. Now in both cases your store would get updated as usual, but you would know that the data you've fetched and you're working with is the latest and greatest and not a state from 2 hours before because of the browser cache.

1

u/prof_hobart Jun 30 '18

It's also potentially a massive security hole if there's sensitive data in there.

But if it works for your particular use case, then as I say, there's nothing about React stopping you using it.

-1

u/[deleted] Jun 30 '18

It's also potentially a massive security hole if there's sensitive data in there.

Ok, I think you're making stuff up now.

5

u/prof_hobart Jun 30 '18

Oh dear. I hope you don't work on any secure sites.

1

u/[deleted] Jun 30 '18

I'm sure Google will reward you handsomely when you demonstrate to them how their flagship browser has massive security holes in it.

3

u/prof_hobart Jun 30 '18

Where do you think a browser caches its data?

It's not designed to store secure data, and if you don't do that there's no security hole. The security hole comes when you choose to misuse a feature.

1

u/[deleted] Jun 30 '18

So don't cache secure data. Not sure why you brought this red herring up.

3

u/prof_hobart Jun 30 '18

Red herring? How?

Much of the data that I deal with on a daily basis is secure data - personal details, financial records etc. They are not things that should be stored in the browser's default cache. A large amount of apps will have data like that, meaning that for large amounts of data, the browser cache is a complete non-starter as an option.

The fact that two posts ago, you didn't seem to realise this was an issue at all suggests that either you're not working on those sorts of site or you shouldn't be.

1

u/[deleted] Jun 30 '18

I didn't recommend storing personal details in the browser cache, but I'm curious, what is the massive security hole in doing so?

→ More replies (0)

16

u/reboog711 Jun 30 '18

Have you ever looked in the node_modules directory of an Angular project? The last time I did it had over 400 directories. That is 400 different projects that my app depended upon.

I think your argument about about third party libraries is valid, however it is completely unrelated to React.

10

u/[deleted] Jun 30 '18

The difference is that Angular is essentially a facade in front of all these Node modules. Angular is responsible for ensuring that they all work properly. If there was a problem with any one of them, that would be a bug with Angular and the Angular team would have to fix it. Compare that with working with React where you are responsible for researching the modules and libraries that you use and making sure that they all work together.

7

u/reboog711 Jun 30 '18

That's not true with the apps I build.

I have used a lot of external libraries that do not come directly from the Angular team--ng material, ng bootstrap, and ag-grid are a few more common ones. It is not the Angular teams responsibility to diagnose and fix bugs with these third party libraries.

15

u/[deleted] Jun 30 '18

I read up until “why does your front end even need a store”... you have no idea man.

There are loads of reasons to persist data on the front end. PWAs not the least of them.

3

u/[deleted] Jun 30 '18

PWAs use Service Workers.

4

u/[deleted] Jun 30 '18

Sure does - but you still want to persist data so that the app works offline.

2

u/[deleted] Jun 30 '18

7

u/[deleted] Jun 30 '18

Ok, so you initially said you don’t think you should persist data on the front end, but now you’re ok with it?

2

u/[deleted] Jun 30 '18 edited Jun 30 '18

I'm telling you what Service Workers are for.

3

u/ianwcarlson Jun 30 '18

A great example of needing to persist data in the frontend is a drawing app like draw.io. In other cases, it's about enhancing the user experience by reducing latency and spinning loaders every time they want to go from one page to the next.

3

u/[deleted] Jun 30 '18

Yes. There’s loads of reasons to do it so op discounting a frontend store is just silly.

6

u/zmasta94 Jun 30 '18

I think you're being overly harsh. I'm in the Angular boat but appreciate that React is sometimes the better answer to a lot of problems.

React probably has all, or most, of the issues you've mentioned above - but Angular has it's fair share too.

Totally agree with Angular losing developers after the migration. They really cocked that one up.

2

u/[deleted] Jun 30 '18

They did. Angular2 should probably have had a different name. And they should have had a migration path defined right from the start. None of this though has any bearing on whether Angular 2 itself is good or bad.

4

u/DOG-ZILLA Jun 30 '18

Why would you say that you need to pass all this stuff as props down the chain when you also rant on about having a Redux store? That’s what a state management system can alleviate.

-4

u/[deleted] Jun 30 '18

The point is that neither are good solutions.

9

u/ianwcarlson Jun 30 '18 edited Jul 01 '18

Most of the arguments against React are valid, but they ignore the advantages of React and are assuming the context is a green-field app. Angular is very opinionated and difficult to start incrementally introducing it into the frontend. There are still lots of Jquery apps out there. Using React makes the transition very flexible and easy.

Dependency injection has downsides too. In order to consume anything, like a third-party GIS mapping library for example, that isn't included in the canonical set, it needs to be wrapped in code to be consumable into the DI framework. This is potentially significant boilerplate to add if the app has dependencies that aren't included in the core libs. Since React just uses ES6 modules, most third-party libs are immediately consumable.

I think the argument about React devs having to piece together third-party libs has merit, but is overstated. React, Redux, React-router are pretty tightly coupled in terms of compatibility (React-router a little less so). Also, there is some really bomb-ass stuff like Jest, that you'd be missing out on if you're set on canonical.

React is the only major frontend library that puts HTML into Javascript. I can't stress how significant this is. All the other ones put JS into HTML. Doing it the non-React way creates custom DSLs that all have their own way of repeating a snippet of HTML or conditionally displaying something. JSX is just HTML folks. It's 99% faithful, just slightly syntactically different.

Because React is 100% JS, it's inherently capable of very powerful things: i.e., higher-order components or functions that return functions/components. HOCs provide a pattern for mixins, but also allows the code to bind values to a component via a closure so that code can be heavily re-used, and configured different during the bootstrap phase of the app. For example, you can configure HOCs to map to different parts of the Redux state without modifying the HOC itself. This is very useful for reusable components that store state in Redux.

I actually generally agree with your arguments about React and Redux, but I don't think you provide the full picture. Lots of apps aren't green-field. This is where a incremental transition to something else is easier with less opinionated libraries.

All major frontend frameworks are very capable of building a solid, maintainable UI. Whenever someone tells me they're rewriting their entire frontend from Angular to React (or vice versa) I cringe. To the users and the stakeholders, the framework doesn't matter, but spending 3 months not pushing features does.

Edit: grammar

3

u/XPTranquility Jun 30 '18

Just here so I won’t get fined.

0

u/[deleted] Jun 30 '18

[deleted]

4

u/akujinhikari Jun 30 '18

Just want to echo that IF React is faster, it’s insanely marginal. I’ve seen a lot of benchmarks for different versions, and some comparable versions of Angular were faster than React. But even then it was insanely marginal. I don’t know where this myth started, but its empirically false.

1

u/[deleted] Jun 30 '18

Yes, the problems of race conditions can be solved by writing more code: That's called 'bug fixing'. Nor does Redux advertise these problems, and in my case I only learned about them when I encountered them myself. Redux Observables are the solution imho. Angular of course is built with Observables tightly integrated into it. Apparently the Angular team understand this problem and have picked the correct solution.

Your arguments about performance boils down to: React is fast and Angular is not. But that needs some serious metrics behind it for it to be true. There have been numerous performance comparisons carried out on React and Angular and I've yet to see any conclusive evidence that one is dramatically superior to the other in terms of performance.

4

u/prof_hobart Jun 30 '18

So the issue here seems to be that you once used Redux, didn't know how to deal properly with async requests, created a bug in your code and blamed Redux for not holding your hand enough.

As I've explained elsewhere, there's plenty of well worn approaches that don't need observables to solve the problem.

Observables are find, and the fact that Angular provides a lot of this out of the box rather than you having to think about it yourself is great for some people.

But for others, the flexibility of approach that you get when you piece together a React-based solution is also an advantage.

1

u/[deleted] Jun 30 '18

No, you can use Redux exactly as recommended in the docs and have this bug. The problem is known about by Dan Abramov himself and he suggests ways to overcome it. The point is, this bug shouldn't be there to start with. https://stackoverflow.com/questions/37738268/how-to-avoid-race-conditions-when-fetching-data-with-redux

6

u/prof_hobart Jun 30 '18

https://stackoverflow.com/questions/37738268/how-to-avoid-race-conditions-when-fetching-data-with-redux

Yes. That would be a pattern for dealing with async. It's not a bug that a particular library doesn't do that magic for you - it only becomes a bug if your code doesn't then add the magic that your chosen library didn't (As Dan said "The problem is due to suboptimal state organization.")

You can argue that library A might be better for you than library B because it makes easier for you to implement a particular pattern, but that's vastly different from claiming that it's a bug in library B because it doesn't do it - if that's not part of library B's remit, it's just up to you to add it yourself.

-1

u/[deleted] Jun 30 '18

Dan's solution doesn't actually remove the problem, it only mitigates it. I disagree with Dan's assertion that if his library doesn't work then it must be your data model that is wrong. Why should the structure of my data have anything to do with whether or not I get a race condition?

As far as I know, the issue isn't flagged anywhere in the Redux documentation (such as the 'Troubleshooting' section?) so it is sitting there waiting to bite someone. The idea that not being able to handle responses coming back out of order is some kind of marginal concern seems strange to me.

5

u/prof_hobart Jun 30 '18

Redux isn't there to solve that specific problem, so why should its docs cover it? Its docs aren't an essay on computer science as a whole, and it's assuming that you've got a fair amount of experience in this kind of thing.

You seem desperate for a one-stop shop framework that spoon-feeds you all of the answers - which is fine, if that's where you are on your professional journey.

But many of us want more flexibility, and realise that this sometime means that we have to do a bit of our own thinking about some of the thornier problems of computer science.

The idea that not being able to handle responses coming back out of order is some kind of marginal concern seems strange to me.

The problem is potentially that you've designed a system where there is such a thing as "out of order" - in most cases, if you're kicking off multiple simultaneous requests, it shouldn't matter what order they come back in.

In situations where it is an issue, there are standard ways to deal with it - which one to pick depends on the nature of the data you're getting back - whether you're cancelling/ignoring the latter responses, overwriting a particular bit of data, checking timestamps etc.

But the point is that you actually need to think about it - the framework isn't going to magically make that decision for you, as it doesn't know your data. It might make some of those solutions easier to implement, but if you're just looking at the framework to solve it for you without doing the thinking yourself, you've got a fair chance of it making the wrong decision.

-2

u/[deleted] Jun 30 '18

if you're kicking off multiple simultaneous requests, it shouldn't matter what order they come back in.

So if the user clicks a button for 'page1', then changes their mind and clicks the button for 'page2' and page 2 appears but is shortly overwritten by page1, that's ok?

2

u/prof_hobart Jun 30 '18

No. Why would it be? And what's this got to do with React or Redux?

→ More replies (0)

2

u/[deleted] Jun 30 '18

That has little to do with redux... and everything to do with how you manage async requests.

1

u/[deleted] Jul 04 '18

Could add to this that PropTypes as a form of Static Type checking are laughable when compared to the equivalent in Angular/Typescript. So embarrassed by them were the React team that they removed them from the core module.

1

u/[deleted] Jul 07 '18

Another problem is that action types are global variables. You need to be careful not to duplicate the name of one. You need to have a good naming convention in place right from the start that is going to be able to cope when your app scales. If the naming convention no longer makes sense when the app scales, refactoring is a huge pain in the ass.

4

u/[deleted] Jun 30 '18

I don't think complaining on redux is great since many use it for Angular as well.

4

u/PostHumanJesus Jul 01 '18

I'm feeling compelled to comment as I think you are borderline spreading misinformation/treating opinion as fact.

Different teams/devs/apps have different needs and use cases. If something works better for you/team/app then that's great. Most of your cons can/have been refuted and can be pros to others.

If you don't like, don't use it. If you think it's harmful to the JS community then learn more about it before bashing. It works fantastically well for lots and lots of teams/apps/companies... So does Angular.

1

u/joesb Jul 01 '18

I could agree with you that React not being full framework comes with some downside. But that is just trade off that is subjective.

The rest, though, is stupid and short sighted. It’s almost like you haven’t wrote a real application at all.

“Source of truth should come from the backend/URL”? This is so naive it hurts. Are you gonna keep all application on the server? Every single item selection? Every keystroke?

Is your app gonna need internet connection all the time?

How do you handle complex editing on client side? Do you ever have UI specific state in your app at all?

“React doesn’t support dependency injection” is also misleading and contradict your previous statement.

“React is not a framework” remember? It neither does or does not support Dependency Injection. It doesn’t prevent you from using DI in anyway.

Please learn to be informed before being a fanboy.

-1

u/[deleted] Jul 01 '18

You might want to address my points rather than just lashing out with insults. It doesn't reflect well on you. Particularly since I haven't said anything against you.

1

u/joesb Jul 01 '18

Beside my last statement, I was addressing your point, wasn’t I?

2

u/crashuniverse Jun 30 '18

I use React and lot of things you mention like Redux, not being a one stop solution and popularity isn't much of a strong differentiator. React did provide very early solutions on server render and simple APIs that shaped front end community forward. The choice is often well suited also on comfort level on the involved team besides features. Your points makes Angular great, not necessarily React bad.

4

u/SparserLogic Jun 30 '18

It's weird reading a list of things portrayed as negatives where all of which I have long viewed as positives.

Your first point alone is enough for me to never recommend or want to work with angular again.

Please spare me the dictatorship of a framework that thinks it knows best.

0

u/akujinhikari Jun 30 '18 edited Jun 30 '18

I haven’t used React more than a beginner’s tutorial, but as soon as I started writing JSX, I said I never wanted to work with React again. That being said, I can’t offer any support for why you don’t like it, but I have worked extensively with Angular, and if all your points about React are valid, then I am so glad I stuck with Angular. All that stuff is so well-integrated into Angular, that it’s easy to take for granted. Thank you for allowing me to appreciate it even more, and also wonder why it gets so much hate in this sub.

1

u/[deleted] Jun 30 '18

My theory is that developers don't like Angular because they are upset about what happened to Angular 1. In every conceivable way it is obviously superior to React - except in performance where they are probably about equal. I think Angular will push on this year. Observables and DI are just such killer features.

2

u/akujinhikari Jun 30 '18

Honestly I think what happened is that Angular integrating Typescript and RxJs made the learning curve pretty steep, so people just said, “Ehhh it’s slow” and moved to things that are much easier to learn: React and Vue. The problem is that now Angular has this stigma that it’s slow, but as you said, its performance is basically the same as React’s. And now people are hailing Typescript and RxJs as awesome libraries, so I continue to wonder why people keep hating on Angular. It’s like the PHP of JavaScript. People make fun of it just because it’s the cool thing to do, instead of actually learning about it.

2

u/[deleted] Jun 30 '18

I think this is true.

1

u/xWalrus11 Jul 03 '18

Angular had a horrible PR start which put it way behind React. But now Angular can do everything React can do and React can do everything Angular can do, it just comes down to developer preference.

3

u/bel9708 Jul 01 '18

IMO JSX is better than Angular templates.

1

u/am0x Jun 30 '18

They have their use cases.

-2

u/croxcrocodile Jun 30 '18

Somebody pin this post.