A full cycle example of a Dashboard using React, Mobx and ReMux, a Flux pattern inspired by Redux
ReMux stand for React Mobx Flux pattern and it's inspired by Redux. The react-portal don't use the ReMux pattern exacly as defined here : https://github.com/vinej/react-remux, because the pattern was improved after developing react-portal
History:
For a simple starter see : https://github.com/vinej/react-remux
Notes:
You need to install 'react-portal-server' to run the application
There are 2 servers
This example is built with the help of Stephen Grider course 'Advanced React with Redux' (excellent) and some Internet information about Mobx.
The first goal is to experiment using React/Mobx and a Flux pattern like Redux. The second goal is to implement enough features to have a base Framework to start a real project. After one month of testing and implementing real features with the flux pattern I can say that Mobx fulfills my expectations.
There is no obligation to use a Flux pattern with Mobx if your application is simple. During the last year, I worked on a Dashboard implementation and the customer asked me to audit all actions from the users. If you have a Flux pattern, it's very easy to do : you just add a resolver (middleware). Without it, it could become complexe to implement it. So, you must use a Flux pattern when you know that you will deal with this kind of feature.
With React/ReMux
Stores use mutable data
Stores contain actions with Mobx @action decorator
Stores actions are called through resolvers to update the data
Stores are passed as props to Components (must of the time)
Stores attributes are observables with the @observable decorator
Stores are singletons or intance classes as needed
Components are refreshed with Mobx @obserser decorator
Components props are validated with 'propTypes'
Components use model shape to validate entity with React.PropTypes.shape
Components use 'dispatch' function to dispatch actions creator
Components must use stores' data in read only mode
JYV