Live data from Hacker News

Why you might not need MVC with React.js

code-experience.com

21–30 of 81 posts

Re: Why you might not need MVC with React.js

#21
post #3

I've been doing a broad survey of these JavaScript frameworks for a month or so now. I've looked primarily at Ember, Angular, React, and Knockout. One thing is for sure: React has the community that feels the most "enlightened." I've watched several videos and read several posts similar to this one that express this sentiment of "when I finally understood it, it just clicked , and now I realize it's the best thing in…

> "when I finally understood it, it just clicked, and now I realize it's the best thing in the world." There's very little to understand, it's really really simple. With React, I don't really see the point of Ember or Angular, they're basically zombie projects now. I wonder how their devs feel about React. React is an evolutionary leap enabled by their shadow DOM technology. Being able to rerender the whole page in a…

ractive.js (which I've been using on a couple of projects) also uses a shadow DOM and learning it is shorter than this sentence.

Re: Why you might not need MVC with React.js

#22
post #7
post #5

If you want a mostly pure DOM-based framework, take a look at Polymer, too ( http://www.polymer-project.org/ ). Web components seem to really embody what the article is driving at.

Isn't React a mostly pure DOM-based framework as well?

Not really: a lot of its value is in the fact that the DOM gets abstracted away as "just another render target" (canvas, and perhaps even eventually native UI's could be potential future targets)

React can fully render out to a string of HTML without any dependencies on a DOM implementation (for instance, if you're on the server)

(http://facebook.github.io/react/docs/top-level-api.html#reac...)

Re: Why you might not need MVC with React.js

#23
post #4

I think this is a misrepresentation of what makes React.js valuable. React is useful for optimizing your rendering (model state -> DOM state) because you don't have to think about re-rendering sub-views of things that haven't changed. This has nothing to do with defining a communication flow for your app. You're still propagating state up and down your tree whether it is a tree of Backbone views or React components.…

Composite view management is made easy with React,much more difficult with string templates and Backbone views.

There are Backbone plugins that help but they dont solve the problem at the source,innerHTMLing views is a bad solution to a difficult problem.

What React doesnt solve is the relationship between the view and a model layer outside the view in an frontend application.

AngularJS does solve that problem but it has an expensive cost.

I think we live in an exciting time where problems like these are about to be solved.

Someone,somehow will figure out how to do things the right way. I wish I could,not smart enough,sorry ;)

Re: Why you might not need MVC with React.js

#24
post #3

I've been doing a broad survey of these JavaScript frameworks for a month or so now. I've looked primarily at Ember, Angular, React, and Knockout. One thing is for sure: React has the community that feels the most "enlightened." I've watched several videos and read several posts similar to this one that express this sentiment of "when I finally understood it, it just clicked , and now I realize it's the best thing in…

That has less to do with React specifically, and more to do with how languages/tools/libraries generally gain adoption. React is at a point where there's still an emerging "early-adopter" community. Angular was like that a year ago (I distinctly recall the tone on HN to be similar to your impression of the current sentiment around React). Now Angular is starting to reach the mainstream (loosely defined), which means…

I wonder how true that will be given the simplicity of React. Ember and Angular and so big that it takes that long to find the things you don't like. Having said that, I like angular and react in very different ways.

Re: Why you might not need MVC with React.js

#25
There's been quite a bit of hyperbole thrown around about React lately (both positive and negative) but one thing that can't be overstated is the fact that the virtual DOM + React's diffing algorithm and the performance and architectural elegance it brings to frontend development is pretty amazing.

I see parallels in the transition from c, to a Ruby/Python/C# development experience (where a lot of low level and error prone details are abstracted away, giving a developer a lot more expressive power in a higher level language)

Re: Why you might not need MVC with React.js

#26
post #21

Earlier quoted context omitted.

> "when I finally understood it, it just clicked, and now I realize it's the best thing in the world." There's very little to understand, it's really really simple. With React, I don't really see the point of Ember or Angular, they're basically zombie projects now. I wonder how their devs feel about React. React is an evolutionary leap enabled by their shadow DOM technology. Being able to rerender the whole page in a…

ractive.js (which I've been using on a couple of projects) also uses a shadow DOM and learning it is shorter than this sentence.

So does Mithril, which weights 8kB minified.

http://lhorie.github.io/mithril/

Re: Why you might not need MVC with React.js

#27
post #3

I've been doing a broad survey of these JavaScript frameworks for a month or so now. I've looked primarily at Ember, Angular, React, and Knockout. One thing is for sure: React has the community that feels the most "enlightened." I've watched several videos and read several posts similar to this one that express this sentiment of "when I finally understood it, it just clicked , and now I realize it's the best thing in…

That has less to do with React specifically, and more to do with how languages/tools/libraries generally gain adoption. React is at a point where there's still an emerging "early-adopter" community. Angular was like that a year ago (I distinctly recall the tone on HN to be similar to your impression of the current sentiment around React). Now Angular is starting to reach the mainstream (loosely defined), which means…

I don't know, I think the excitement around angular was because it made things easy, while the excitement around react is based on its simplicity of its model. It's a deeper thing than just being a shiny new thing imo.

Re: Why you might not need MVC with React.js

#28
post #3

I've been doing a broad survey of these JavaScript frameworks for a month or so now. I've looked primarily at Ember, Angular, React, and Knockout. One thing is for sure: React has the community that feels the most "enlightened." I've watched several videos and read several posts similar to this one that express this sentiment of "when I finally understood it, it just clicked , and now I realize it's the best thing in…

> "when I finally understood it, it just clicked, and now I realize it's the best thing in the world." There's very little to understand, it's really really simple. With React, I don't really see the point of Ember or Angular, they're basically zombie projects now. I wonder how their devs feel about React. React is an evolutionary leap enabled by their shadow DOM technology. Being able to rerender the whole page in a…

> With React, I don't really see the point of Ember or Angular

React only deals with the view. In AngularJS, third party objects have a seamless integration with the view.

Imagine you want to paginate datas.

You'd write a Paginator component in React.

In Angular you'd have a Paginator service holding pagination logic. Then you can have multiple representations of paginators,that would be logic less. It's better because it makes it easier to test the pagination logic in isolation,and you can then hide some complexity out of the view.

i did it with a simple notification queue in a project i'm working on :

		.service('Notification', function($timeout, NOTIFICATION_TIME) {
			/**
			 * manage notifications
			 */
			var onNotificationTimeEnd ;
			this.type = {
				'SUCCESS': 'text-success',
				'ERROR': 'text-error',
				'INFO': 'text-info'
			};
			this.timeout = null;
			this.current = null;
			this.notifications=[];
			/**
			 * queue app notifications
			 * @param  {Object} notif
			 */
			this.notify = function(notif) {
				if(notif){
					this.notifications.push(notif);
				}
				if(!this.current){
					this.current = this.notifications.pop();
				}
				if(!this.timeout){
					this.timeout=$timeout(onNotificationTimeEnd.bind(this), NOTIFICATION_TIME);					
				}
			};
			onNotificationTimeEnd = function(){
				this.current=null;
				this.timeout=null;
				if(this.notifications.length>0){
					this.notify();
				}
			};
			
		});
So each time a new notification pops , the view is updated just by adding {{Notification.current}} somewhere in my template

I think React solve parts of the problem while Angular tries to solve the whole problem.

I think there is definetly a middle ground between AngularJS and React virtual DOM that can be found. Let's remember that Misko defines AngularJS as "a better browser",not a framework.

Re: Why you might not need MVC with React.js

#29
The article links to Facebook's example of a React app, which is available on JSFiddle [1]. I've been playing with using React:

- without its JSX templating

- with Coffeescript

...ever since I saw the idea here on HN a few months ago [2]. Here's the JSFiddle for that [3], I am a huge fan of the way you can pretty much write your DOM using (essentially) javascript functions.

[1] http://jsfiddle.net/3Vs3Q/light/

[2] https://news.ycombinator.com/item?id=7232695

[3] http://jsfiddle.net/mFXVL

Re: Why you might not need MVC with React.js

#30
post #27

Earlier quoted context omitted.

That has less to do with React specifically, and more to do with how languages/tools/libraries generally gain adoption. React is at a point where there's still an emerging "early-adopter" community. Angular was like that a year ago (I distinctly recall the tone on HN to be similar to your impression of the current sentiment around React). Now Angular is starting to reach the mainstream (loosely defined), which means…

I don't know, I think the excitement around angular was because it made things easy, while the excitement around react is based on its simplicity of its model. It's a deeper thing than just being a shiny new thing imo.

My personal impression of Angular and its community is that it makes things organized and maintainable, not necessarily easy in the greedy sense of "I want to get this little app made as quick as humanly possible."
Post reply on HN