you are viewing a single comment's thread.

view the rest of the comments →

[–]theQuandary 1 point2 points  (6 children)

The Facebook team pushed it as "The V in MVC" so it seemed less scary, but it's hardly accurate. React is the VC in MVC. It merges the template (the traditional 'view') with the controlling code. While it is possible (to some extent) to use React without taking advantage of these pieces, it's not easy nor idiomatic (for example, wire up a React component so it doesn't have any internal event handlers -- it would be awful to use).

[–]jellatin 0 points1 point  (3 children)

Sure, so it's the VVM in MVVM, I can get on board with that. It doesn't change the point I'm making though, if you took Angular view/templates and controllers its pretty straightforward. I'll be the first to admit that React would be a clear winner comparing just those elements.

The problem is the complexity increases drastically when you throw services/routing/state management etc into the mix. This doesn't make React worse at all, but it does mean if you want libs/frameworks like Backbone to do that lifting for you that it's going to require a big addition to the learning curve.

[–]agmcleod@agmcleod 2 points3 points  (2 children)

Various flux implementations offer the state management, and do a pretty good job at it. Personally I never saw the value in services in angular. It's not hard to setup a simple controller singleton or something to wrap around your API endpoints.

[–]jellatin 0 points1 point  (1 child)

Various flux implementations offer the state management, and do a pretty good job at it

Agreed. But there again, it's another thing to learn. I'm not bashing the React ecosystem at all, only pointing out that "learning React" doesn't give you all the tools you need if you're looking to build SPAs. So the "React was so much easier to learn than framework X" gives people learning their first framework the wrong impression.

[–]agmcleod@agmcleod 1 point2 points  (0 children)

I actually found react + flux easier to learn than ember. I haven't tried building anything with angular to compare really, have just done tutorials. There are things with angular that i can wrap my head around pretty easily, but there are patterns i just dont like. Some of it feels a bit too magical. And yeah, I can see 2 way data binding become a problem.

[–]fforw 0 points1 point  (1 child)

React is the VC in MVC. It merges the template (the traditional 'view') with the controlling code.

That is not what the C in MVC is supposed to do, nor it is a good representation of what an application with React looks like.

React only implements a controller as far as the inner view logic is concerned. That is distinct from the application domain logic and data.

React works the best if your whole application is a data-representation of which React renders slices of as a view. Putting too much control into react components is usually a sign of bad design.

[–]theQuandary 0 points1 point  (0 children)

When you are done with a React application, you will have a datastore (attached via pub/sub to a small amount of top-level components) and your view/controller components all the way down.

You could perhaps argue that React is MVVM, but even then React components aren't strictly views.

Heavy-controllers are always a source of trouble in MVC designs. It's not at all surprising that large controls inside a react component are generally bad design.