Skip to content

Commit 0777be0

Browse files
committed
add english version of getting-started, and reorganize file directory
1 parent c3bea33 commit 0777be0

File tree

5 files changed

+453
-33
lines changed

5 files changed

+453
-33
lines changed

en-us/README.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

en-us/concepts/01-basic.md renamed to en-us/concepts.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
## Basic
1+
# Concepts
22

3-
### Data Flow
3+
[以中文版查看此文](../zh/concepts.md)
4+
5+
## Data Flow
46

57
![pic](https://camo.githubusercontent.com/c826ff066ed438e2689154e81ff5961ab0b9befe/68747470733a2f2f7a6f732e616c697061796f626a656374732e636f6d2f726d73706f7274616c2f505072657245414b62496f445a59722e706e67)
68

7-
### Models
9+
## Models
810

9-
#### State
11+
### State
1012

1113
`type State = any`
1214

@@ -19,7 +21,7 @@ const app = dva();
1921
console.log(app._store); // top state
2022
```
2123

22-
#### Action
24+
### Action
2325

2426
`type AsyncAction = any`
2527

@@ -31,7 +33,7 @@ dispatch({
3133
});
3234
```
3335

34-
#### dispatch function
36+
### dispatch function
3537

3638
`type dispatch = (a: Action) => Action`
3739

@@ -46,7 +48,7 @@ dispatch({
4648
});
4749
```
4850

49-
#### Reducer
51+
### Reducer
5052

5153
`type Reducer<S, A> = (state: S, action: A) => S`
5254

@@ -63,14 +65,14 @@ Reducer's concepets from FP:
6365

6466
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).
6567

66-
#### Effect
68+
### Effect
6769

6870
In dva, we use [redux-sagas](http://yelouafi.github.io/redux-saga/) to control asynchronous flow.
6971
You can learn more in [Mostly adequate guide to FP](https://github.com/MostlyAdequate/mostly-adequate-guide).
7072

7173
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.
7274

73-
#### Subscription
75+
### Subscription
7476

7577
Subscriptions is a way to get data from source, it is come from elm.
7678

@@ -89,11 +91,10 @@ app.model({
8991
});
9092
```
9193

92-
### Router
94+
## Router
9395

9496
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.
9597

96-
9798
dva provide `router` function to control router, based on [react-router](https://github.com/reactjs/react-router)
9899

99100
```javascript
@@ -105,18 +106,15 @@ app.router(({history}) =>
105106
);
106107
```
107108

108-
### Route Components
109+
## Route Components
109110

110111
In dva, we restrict container components to route componenst, because we use page dimension to design container components.
111112

112113
therefore, almost all connet model componets are route components, route components in `/routes/` directory, presentational Components in `/components/` directory.
113114

114-
#### References
115+
## References
115116
- [redux docs](http://redux.js.org/docs/Glossary.html)
116117
- [Mostly adequate guide to FP](https://github.com/MostlyAdequate/mostly-adequate-guide)
117118
- [choo docs](https://github.com/yoshuawuyts/choo)
118119
- [elm](http://elm-lang.org/blog/farewell-to-frp)
119120

120-
121-
122-

0 commit comments

Comments
 (0)