Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well you need a router and a way to persist data.Does React offer this?

How do I manage page changes with React?

React only concern is the view afaik. An app is more than a view,even in the client.

So react is not MVC,but you still need MVC somewhere.unless you write one page apps of reactive documents.

> It does not define how communication flows.

I think it does ,in pure MVC:

- view is stateless,view is 100% model driven.

- controller gets events.

- controller modifies the model.

- model notifies the view to update.

Of course that is in theory. In practice the view has states.

The difficulty of "pure" MVC is that the model doesnt represent some data from the server or whatever, but the states of the view.

The other problem is,in the browser,obviously the DOM has states. That's why MVC is not good for front-end dev,since it negates how the DOM works.

Virtual DOMs are better as they embrace how the DOM works. And yes the DOM is a tree.Trying to reproduce a tree with Backbone views and underscore template is madness.

Let's remember that MVC is a really old pattern ,created in a time where UIs were coded quite differently.



React doesn't offer routing. The React TodoMVC implementation uses Director, a separate library for routing: https://github.com/tastejs/todomvc/tree/gh-pages/architectur...


The devs that created React are using React + Backbone.Router for Instagram's desktop site.

It's very easy to integrate Backbone.Router into a project.


You can also use something like react-router-component which integrates very easily with React:

https://github.com/andreypopp/react-router-component


> So react is not MVC,but you still need MVC somewhere.unless you write one page apps of reactive documents. In that case I think ractive is easier to use than react.

i think MVC is defined without regard for the number or pages or how said pages might be routed. you don't "need MVC somewhere".




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: