r/javascript • • Dec 15 '15

Angular 2 Beta is now available

http://angularjs.blogspot.com/2015/12/angular-2-beta.html
140 Upvotes

88 comments sorted by

View all comments

Show parent comments

10

u/lingodayz Dec 15 '15

React is nice and simple. And is only concerned with the view. Use whatever you like elsewhere.

2

u/9thHokageHimawari Dec 15 '15

Never liked .jsx, but I guess I gotta check it out.

Flux is something like M/C, but its bound to V right?

6

u/jbarket Dec 16 '15

Once you actively use JSX, I think it becomes a lot less weird. I still wish conditionals in it were first class citizens, but it's never stopped me from getting stuff done.

Comparing React to MVC is always a bit weird. People say it's the V, but components can have any kind of logic in there you want. You can retrieve data when the component loads, bind it to the view, send AJAX events back out when you update data, et cetera.

There's just no strict pattern to it. You're doing all of that in plain old JS, and React is really just responsible for rendering what you do and providing some life cycle hooks.

The Flux pattern solves a lot of problems you end up with when you do this, like sharing information between components, and organizing code in a way that lets you make your components dumber (which makes them easier to reuse).

I highly recommend just playing with vanilla React for a bit. It's super fast to learn, enjoyable to use, and you will quickly figure out why patterns like Flux exist. I had no appreciation for all of the extra files and boilerplate of Redux until I started building something in React, and suddenly it all made sense.

4

u/Untit1ed Dec 16 '15

I still wish conditionals in it were first class citizens

Check out https://github.com/AlexGilleran/jsx-control-statements

(disclaimer: self-promotion)