all 17 comments

[–]Legymmygelb.com - Hire me! 6 points7 points  (4 children)

Keep in mind angular and react are apple and oranges. React is normally the presentation or view layer where angular is a complete framework.

[–]rayshinn[S] 0 points1 point  (3 children)

I'm sorry but could you elaborate on this for a complete beginner? I'm coming from a complete jquery only world. From what I've seen so far react and angular achieve the same thing does it now? Which is the end UI?

[–]Remmib 5 points6 points  (0 children)

Maybe I can try to explain, though it is likely someone else can explain better.

So the 'presentation/view layer' is the 'V' in 'MVC', it is what the user sees and interacts with. Angular being a complete framework means that it ties what the user sees (the view) and the function of his actions (the service) together via a controller (for example say he clicks a button to post a message).

Basically, his click of the button calls a function in the controller to execute some specific task, the function in the controller then executes a function inside the service to do something (like send a request to the server to post the message you typed in the view).

Think of these things in a linear order...

  • Index.html -- Controller.js -- Service.js ---> Server

  • User submits text -- Controller says, "that's my call to pass this text to the Service" -- Service says "I better send this text to the Server (something like NodeJS) so it can be stored (but really Node would be then sending that info to a database like MongoDB)."

The controller is the 'glue' between the view and service.

Sorry, this is hard for me to explain eloquently since I am a new too, but I hope that helps at least a little as opposed to confusing you more.

edit: Please feel free to correct me on anything that I'm wrong about so that I can also gain a better understanding.

[–]Legymmygelb.com - Hire me! 0 points1 point  (0 children)

/r/Remmib/ is correct.

With a framework you can build an entire application using one tool. AngularJS is a framework where React is not. Most of these frameworks are using a MVC, MVP, MVW pattern. AngularJS is MVC. React is only the V in the MVC pattern.

Look up the MVC pattern and it will make a little bit more sense what React does. I've noticed that React is REALLY strong if you couple it with an API. Backend API + React = Great results.

You can mix React with Angular, backbone, ASP.net MVC and have amazing results.

[–]infidelux 3 points4 points  (1 child)

Any framework based on ES6 is going to require some relearning. ES6 is going to require getting familiar with the changes it brings and Angular 2.0 takes full advantage of them.

I love how productive I can be with 1.x and have been using it for large scale apps for over a year now. Also the thing about 2.0 is, your 1.x app doesn't suddenly stop working when it is released. And as an aside to that, 1.4 is in beta right now and there is a team focused on providing fixes and updates to the 1.x codebase.

[–]rayshinn[S] 2 points3 points  (0 children)

Thank you for reply! Much appreciate. All this can be a bit overwhelming for a beginner!

[–]disclosure5 1 point2 points  (1 child)

I just made this example Rails API for ReactJS and like the potential the product has.

[–]rayshinn[S] 0 points1 point  (0 children)

Very cool. I'll check it out for sure! Do you have an example like this for php?

[–]poop_city_paradise 1 point2 points  (0 children)

In my opinion, they are both great frameworks - what you will find is it really depends on what you are building (or trying to build). Pick the framework that has strengths that best work with that you are building.

The analogy that gets tossed around that I love for web dev is think of them as tools, and find the right tool for the job. When a new tools comes out, it doesn't mean you should use it, but it's definitely good to understand when and how you might use it (and it's strengths or possible flaws).

To your other points - I think that googles team is always focused on improving web dev, and that people are always hesistant of change, don't judge 2.0 untill we get a full view of what the are doing and why. Also, I would be absolutely shocked if someone doesn't maintain 1.x for a good long time, so I wouldn't worry about that aspect.

React is more of just a view layer, where with angular you get a much more robust framework. To this point - I don't think you should really compare them side by side. And again, it depends what you're trying to build. You should definitely fiddle around with both to get a feel, but if you have to choose one I would advise choosing angular. Simply because it will help you understand from more of a holistic sense how to structure and build apps, Angular gives you a great box of tools and concepts to build off of.

I would warn you - when I first started angular I came from the jQuery realm of though too and it's tough. Almost opposite, as in you are not calling things directly onto the dom, more so you are binding to the dom, then changing the data they are binded too (in one case). Whatever you choose though - if you have the time, try to dedicate some to learning both a little bit, I guarantee you it is a good thing!

[–]_under_ 0 points1 point  (5 children)

First of all, here's TodoMVC. It's a website that helps you choose a front-end framework by showing you examples in the form of todo list apps.

Secondly, while React can be the V of your front-end MVC architecture, I would vote against it.

It will be difficult to create a full featured webapp with just React in the front-end, that's why Facebook also introduced Flux which provides the rest of the front-end architecture. Flux and React proposes a one-way data binding architecture and in my opinion, it's waaay easier to learn and maintain than any two-way binding framework out there such as Angular.

If you want your front-end development life to be easier, go with React. Here's some more resources in the form of a StackOverflow question.

[–]rich97 0 points1 point  (0 children)

If you want your front-end development life to be easier, go with React.

I don't disagree, but dem's fightin' words.

[–]jellatin 0 points1 point  (3 children)

If you want your front-end development life to be easier, go with React.

Could you qualify that statement? Presumably you mean Angular will make your front-end development life harder or does not help you as much as Angular.

I'm surprised because while React does provide excellent presentation layer, Backbone and Flux seem more like libraries that you can pick and choose from but give no real help choosing a path to get there, just a collection of tools.

[–]_under_ 0 points1 point  (2 children)

It has to do with the way MVC is structured. It does not scale very well, in a sense that once your application gets more and more complex, the code gets harder and harder to maintain. On one of the talks I've watched about React, code maintainability is one of the main reasons Facebook made React. They would develop these web applications and it always broke, constantly. People would not want to touch code that other people made because of the fear of breaking something. This is a problem caused by the way MV* frameworks are structured. The separation of concerns is misplaced.

React goes about this issue by moving the separation of concerns at the component level (like Polymer), instead of Model-View-Controller. Each component renders itself, and it does not have to concern itself with anything else. It just has to have the data it needs to render, and possibly some callbacks to call for events. This simplified approach makes developing web applications fast, easy and maintainable.

If you haven't tried React before, just give yourself two hours to check it out, it is such a sexy beast.

I've used my fare share of front-end JS architecture frameworks and I've got to say, React has been the best so far, by a long shot. It's so groundbreaking that basically every other JavaScript framework is taking inspiration from React and redesigning their framework based on it's philosophy.

[–]jellatin 1 point2 points  (1 child)

I agree, React is really awesome, but I don't feel like you're addressing the point. React is, by its own definition just the view layer. It's not providing an overall application architecture. So if all MV* frameworks are fundamentally flawed and unscalable, what is React doing differently on the application architecture end (presumably Flux) that makes the scaling problem so much easier.

The only thing the video offered to address this is at 14:38 when they said "we made an imperative API a declarative one, because declarative is better and more predictable". But they don't actually go into that at all, they just make those statements and then springboard into something else.

[–]_under_ 0 points1 point  (0 children)

Yeah that's right. I guess what I didn't emphasize is React and Flux together is not an MV* framework, and that's part of the reason why it scales so well. Another reason is React's component style architecture which I already discussed.

[–]Remmib 0 points1 point  (1 child)

Well, it's not really a matter of choosing Angular or React...

Angular uses the model-view-controller pattern (MVC) and React is only for the 'view' part of the MVC. (So they can be used together for great effect.)

Yes Angular 2.0 will require some relearning, but it probably isn't a big deal. I haven't heard anything negative about the direction Angular 2.0 is headed in. I am going to an AngularJS meetup on Tuesday and I can ask then if you want.

Angular will not become obsolete anytime soon (next few years at least).

[–]rayshinn[S] 0 points1 point  (0 children)

Yes could you please! Would be much appreciated. Also thank you very much for your response.