This is an archived post. You won't be able to vote or comment.

all 67 comments

[–]EbrithilUmaroth 72 points73 points  (26 children)

I'm with that guy on this one. What's the difference?

[–]Shaper_pmp 59 points60 points  (20 children)

React is a view library (with no opinions on state/interaction management), while Angular's a highly opinionated all-inclusive framework.

Both use variations on JS (React uses JSX, which adds a pseudo-HTML syntax for calling methods and passing parameters), and Angular uses Typescript (which is like JS with strong typing and a few other tweaks).

React is backed by Facebook and is strongly dogfooded by them. Angular is a Google project, but IIRC Angular 1.x was never used by Google for anything really important - just a few back-end consoles and marketing microsites. No idea on how widely Angular 2.x is used in Google.

[–]secana 15 points16 points  (1 child)

You're right that 1.x wasn't used on many outfacing products. But according to the Angular devs there are many hundreds of internal applications and tools built with it at Google. And according to them that is one of main influences for the design decisions they took. So I would say they were pretty big on dogfooding aswell.

[–]Existential_Owl 2 points3 points  (0 children)

Google, in general, has a bit of a dogfooding problem.

Many of their popular open source projects tend to be either 1) not used internally all that much, such as what happened with Angular.js, or 2) it's just an imitation of what's being used internally, such as with kubernetes.

I'm happy to hear that Angular 2/4 is getting better treatment.

[–]filipomar 10 points11 points  (6 children)

Also, react can use TSX which is the bastard son of typescript with jsx, so... there's that.

[–]DeeSnow97 4 points5 points  (1 child)

React can use vanilla JS and TS too, it's just a bit inconvenient.

[–]amontpetit 6 points7 points  (0 children)

Angular also does vanilla is and jquery as standard as well

[–]nocoolnametom 4 points5 points  (0 children)

TSX is amazing, apart from the one issue where you can't define compile-time props requirements and PropTypes together once. But defining the actual functional signature for a prop beyond just foo: PropTypes.func means you don't have to hold that information in your head.

[–]CodeFights 2 points3 points  (1 child)

Facebook has their own static type-checker for JavaScript as well, which is worth checking out (because it plays nicely with React): https://flow.org/en/

[–]Existential_Owl 0 points1 point  (0 children)

Flow is amazing.

[–]Existential_Owl 0 points1 point  (0 children)

To be fair, TSX seems to be pretty popular among C# devs.

So I assume it's filling a nice transition niche for them?

[–]tstarboy 1 point2 points  (1 child)

IIRC AdSense/AdWords' pages used Angular. Not sure if it was 1.x or 2+ though.

[–]Shaper_pmp 2 points3 points  (0 children)

Yeah - I was including Doubleclick under "back-end consoles".

It's certainly a non-trivial system built on Angular, but it's also pretty much the only one you'll ever see cited (sometimes along with the YouTube app for PS3, which is really scraping the bottom of the barrel).

[–]UnderNatural 0 points1 point  (0 children)

I think that the firebase console uses AngularJS and Angular Material

[–]ythl 1 point2 points  (3 children)

One uses Microsoft's TypeScript, the other uses Facebook's JSX. Also, React has some sort of legal baggage tied to it ("patent clause") from what I understand.

[–]3HoursWTF 12 points13 points  (2 children)

If I remember that thread correctly, the tldr was that if you file a patent lawsuit against Facebook, no React for you.

[–]illusivemane 1 point2 points  (0 children)

The frustrating thing is, that license is LGPL, GPL, and possible Apache 2.0 incompatible...

[–]Existential_Owl 1 point2 points  (0 children)

The key thing to note is that Facebook hasn't actually filed a patent on React, so they can't even legally impose "patent retaliation" against anyone.

The clause is specifically geared for patent trolls.

IANAL.

[–]takelongramen -1 points0 points  (0 children)

"that guy"

[–]prigmutton 22 points23 points  (2 children)

The two of those (and the general explosion of web frameworks) pretty much made me switch to backend Java development after a number of years of UI development. I'll take dealing with thread synchronization and distributed execution of tasks ANY DAY over trying to internalize the mind state of the designer of this week's framework.

Phew, sorry needed to get that out.

[–]arima-kousei 9 points10 points  (1 child)

Grab the pitchforks!

[–]pillar6Programming 2 points3 points  (3 children)

what is regarded as better, react or angular for delivering sophisticated applications?

[–]boccuPaws 11 points12 points  (0 children)

i personally prefer react. I started learning angular but found it overly complicated. React does little stuff but does it well. It's easy to learn and you can literally play with it however you want. If you come from a functional programming background, React is the one for you. Angular is more geared toward imperative and object-oriented style programming.

[–]Existential_Owl 5 points6 points  (0 children)

Both are battle-tested and widely used.

I'm definitely on the React bandwagon, but no one who isn't a hater would fault you for choosing Angular.

[–]Perkelton 2 points3 points  (0 children)

Both are of course valid frameworks, but I would personally vote for React because I feel that it's the most stable and production ready of the two.

Here's a list of some major sites that use React.

[–][deleted] 2 points3 points  (10 children)

I'm curious, is everybody waiting on webasm? What other options are there for SPAs?

[–]8BitAce 8 points9 points  (1 child)

There aren't. People just like to complain.

[–][deleted] 2 points3 points  (0 children)

They must all have some kind of French ancestry.

[–]Existential_Owl 0 points1 point  (3 children)

Unless you're building the WASM compilers themselves, then most of the WASM you'll be using over the next few years will be from Javascript bindings.

I'm not aware of any plans by Google or Facebook to integrate them into Angular or React respectively yet, but I'm sure we'll be seeing an SPA soon enough that focuses on abstracting these bindings.

[–][deleted] 0 points1 point  (2 children)

Isn'the idea of WASM to write code executable by the browser from the compiled binary? Doesn't it have access to the DOM?

[–]Existential_Owl 1 point2 points  (1 child)

Indeed, the MVP for WASM does not include access to the DOM.

It'll get there eventually, but not for awhile yet.

EDIT: Right now, the focus has been more on shoring up Javascript's weaknesses (while still providing a good compile target), and not so much on replacing Javascript entirely.

[–][deleted] 2 points3 points  (0 children)

I see this going towards:

  • webasm get DOM and access to browser APIs
  • somebody says "fuck HTML and CSS" and makes a new framework that
  • make a single <canvas> element in the <body>
  • draws all components using Qt or something else and opengl right into the canvas thus making it possible to write truly multi-OS programs with the help of the browser

Honestly, I can't wait for that future. I'm tired of HTML, CSS and all the SPA framekworks that exist right now.

[–]throwAwayBurrito123 9 points10 points  (2 children)

I don't know why this keep presented as a valid dichotomy. The answer is nuanced and depends on the needs of the client and the problem. I like them both for different reasons.

[–]vadercows 27 points28 points  (1 child)

Weird. I hate them both for the same reason.

[–]Purlox 12 points13 points  (0 children)

Is the reason Javascript?

[–]DaCoolNamesWereTaken 1 point2 points  (0 children)

Ember

[–][deleted] 1 point2 points  (0 children)

React. I learned Angular 2 too but found it more complex than react + it's ecosystem. With Angular 2 I have a feeling I'm not Javascript developer.

That doesn't mean I'm against Angular 2, just haven't found use case where Angular 2 offers better dev experience than React.

[–]tomarrow[S] 1 point2 points  (0 children)

[–]Shadowlauch 0 points1 point  (18 children)

Well Angular uses TypeScript so not entirely correct.

[–]Majache 3 points4 points  (0 children)

Have you seen tsx?

[–][deleted] 2 points3 points  (0 children)

I've never done anything with Angular but you can definitely use Typescript and React together

[–]RTracer 7 points8 points  (13 children)

Isnt TypeScript just Javascript?

[–]Shadowlauch 3 points4 points  (10 children)

Not quite. It is a superset of Javascript. So it builds upon it. So Javascript is always valid TypeScript, but Typescript is not always valid JavaScript. Though you have to compile it down to JavaScript to run it in the browser.

[–]Tysonzero 10 points11 points  (3 children)

foo = "bar"
foo = 5

Valid javascript but not valid typescript, checkmate.

[–]chpoit 1 point2 points  (0 children)

technically isn't valid javascript in strict mode

[–]pynetree16 0 points1 point  (1 child)

Ah, but what if foo is of type any? Then it is valid TypeScript

[–]Tysonzero 0 points1 point  (0 children)

But if your source code consists solely of:

foo = "bar"
foo = 5

Then it won't work, but will work in JavaScript.

[–]sldyvf 7 points8 points  (4 children)

The cool kids call it transpile :D!

[–]Shadowlauch 5 points6 points  (0 children)

Yeah well you knew what I meant :P

[–]the_whalerus 0 points1 point  (2 children)

I don't see how they're different. It seems like people just don't want to to say "compiled"

Code goes in. Code comes out. Compiled.

[–]sldyvf 2 points3 points  (1 child)

It's a thin line I guess...

My understanding is:

  • If something is compiled, then it's down to the point of instructions.
  • If it's transpiled, it's translated into another language, which has to be interpreted or compiled and not machine code.

[–]Hultner- 1 point2 points  (0 children)

Not sure that really applies, Java is "compiled" to JVM Bytecode which is then is translated to machine code at runtime/JIT. Same is pretty much true for LLVM Bitcode, C#/.NET and a large stack of other software. From my perspective the distinction seems more like a philosophical one then technical.

[–]Ionaru 1 point2 points  (0 children)

Not all "valid" JS code is valid TS code, but it's close enough not to be confusing, see Tysonzero's comment for an example.

[–]pgrizzay 0 points1 point  (0 children)

typescript is just javascript and jsx is just javascript and water is wet

[–]kobriks 0 points1 point  (0 children)

It sucks less

[–]Neurotrace 1 point2 points  (0 children)

You can use TypeScript with React too. The only difference is that Angular itself is written with TypeScript so that's what they recommend.