docs: tighten concepts

This commit is contained in:
Yoshua Wuyts
2016-05-16 01:55:04 +07:00
parent 7f1fcff40b
commit 1738ed019b
+8 -11
View File
@@ -56,27 +56,24 @@ document.body.appendChild(tree)
```
## Concepts
- __state:__ a single object that contains all application state, should only
ever be modified by `reducers`
- __state:__ a single object that contains __all__ application state
- __reducers:__ synchronous functions that modify `state`
- __effects:__ asynchronous functions that perform IO. Effects can call
`send()` when done to handle results
- __subscriptions:__ streams of data that can either be written to or read from
- __effects:__ asynchronous functions that emit an `action` when done
- __subscriptions:__ read-only data sources that emit `action`s for new data
```txt
┌───────────────────────────────┐
│ │ ┌────────┐
┌───────────────────────────┐ ┌────────┐
│ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ User │
│ ┌─────────────────┐ │ └────────┘
├────┼─│ Subscriptions │ │ │ │
├──┼─│ Subscriptions │ │ │ │
│ └─────────────────┘ │ ▼
│ │ ┌─────────────────┐ │ │ ┌────────┐ ┌────────┐
└──────│ Effects │◀─────┼────── DOM │◀───────────│ Views │
└────│ Effects │◀───┼────── DOM │◀───────────│ Views │
│ └─────────────────┘ │ Actions └────────┘ DOM tree └────────┘
┌─────────────────┐ │ ▲
│ │ Reducers │◀┼────┘ │
│ │ Reducers │◀┼──┘ │
└─────────────────┘ │
│ │ │ ┌────────┐ │
└─────────────────────▶│ Router │─────────────────┘
───────────────────▶│ Router │─────────────────┘
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ State └────────┘ State
Model
```