What are the advantages of Flux+React over Backbone+React. Are there any performance differences in addition to the code development ease for a huge complex code base.
What if we have a 1:1 relation between the model and a react view in a application that uses Backbone+React ?
Backbone. Backbone has been around for a long time, but it's still under steady and regular development. It's a good choice if you want a flexible JavaScript framework with a simple model for representing data and getting it into views.
What is flux. Flux is a pattern for managing how data flows through a React application. As we've seen, the preferred method of working with React components is through passing data from one parent component to it's children components. The Flux pattern makes this model the default method for handling data.
Front-End MVC frameworks (Backbone, Angular, etc) all rely on a backend service to provide the data that, say Backbone, would then use as its model. You could have an entire MVC pattern on the backend that accepts requests and spits out some JSON for a frontend MVC framework to use.
Node's event emitter is used to update the store and broadcast the update to view. The view never directly updates the application state. It is updated because of the changes to the store. This is only part of Flux that can update the data.
Flux is an architect pattern to build React application. So you can use Backbone models and collections inside your stores to fetch and store data.
And if want to use just React's Virtual DOM feature, there is no need to use react.js. There are a lot of libraries, adding Virtual DOM feature to your application (https://github.com/Matt-Esch/virtual-dom).
My recommendation: if you will use Flux pattern I strongly recommend you to use http://facebook.github.io/immutable-js/ (may be coupled with http://ampersandjs.com/; don't forget to define your custom sync function if you are building isomorphic application). Basically there are no any advantages using backbone models with React (backbone is heavy, it needs underscore, which is slow; I use https://lodash.com/ instead ).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With