You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In dva, reducers accumule current model's state. There are some things need to be notice that reducer must be [pure function](https://github.com/MostlyAdequate/mostly-adequate-guide/blob/master/ch3.md) and every caclulated data must be [immutable data](https://github.com/MostlyAdequate/mostly-adequate-guide/blob/master/ch3.md#reasonable).
65
67
66
-
####Effect
68
+
### Effect
67
69
68
70
In dva, we use [redux-sagas](http://yelouafi.github.io/redux-saga/) to control asynchronous flow.
69
71
You can learn more in [Mostly adequate guide to FP](https://github.com/MostlyAdequate/mostly-adequate-guide).
70
72
71
73
In our applications, the most well-known side effect is asynchronous operation, it comes from the conception of fuctional programing, it is called side effect because it makes our function impure, and the same input may not result in the same output.
72
74
73
-
####Subscription
75
+
### Subscription
74
76
75
77
Subscriptions is a way to get data from source, it is come from elm.
76
78
@@ -89,11 +91,10 @@ app.model({
89
91
});
90
92
```
91
93
92
-
###Router
94
+
## Router
93
95
94
96
Hereby router usually means frontend router. Because our current app is singel page app, frontend codes are required to control the router logics. Through History API provided by the browser, we can monitor the change of the browser's url, so as to control the router.
95
97
96
-
97
98
dva provide `router` function to control router, based on [react-router](https://github.com/reactjs/react-router)。
98
99
99
100
```javascript
@@ -105,18 +106,15 @@ app.router(({history}) =>
105
106
);
106
107
```
107
108
108
-
###Route Components
109
+
## Route Components
109
110
110
111
In dva, we restrict container components to route componenst, because we use page dimension to design container components.
111
112
112
113
therefore, almost all connet model componets are route components, route components in `/routes/` directory, presentational Components in `/components/` directory.
0 commit comments