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 ## Concepts
- __state:__ a single object that contains all application state, should only - __state:__ a single object that contains __all__ application state
ever be modified by `reducers`
- __reducers:__ synchronous functions that modify `state` - __reducers:__ synchronous functions that modify `state`
- __effects:__ asynchronous functions that perform IO. Effects can call - __effects:__ asynchronous functions that emit an `action` when done
`send()` when done to handle results - __subscriptions:__ read-only data sources that emit `action`s for new data
- __subscriptions:__ streams of data that can either be written to or read from
```txt ```txt
┌───────────────────────────────┐ ┌───────────────────────────┐ ┌────────┐
│ │ ┌────────┐
│ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ User │ │ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ User │
│ ┌─────────────────┐ │ └────────┘ │ ┌─────────────────┐ │ └────────┘
├────┼─│ Subscriptions │ │ │ │ ├──┼─│ Subscriptions │ │ │ │
│ └─────────────────┘ │ ▼ │ └─────────────────┘ │ ▼
│ │ ┌─────────────────┐ │ │ ┌────────┐ ┌────────┐ │ │ ┌─────────────────┐ │ │ ┌────────┐ ┌────────┐
└──────│ Effects │◀─────┼────── DOM │◀───────────│ Views │ └────│ Effects │◀───┼────── DOM │◀───────────│ Views │
│ └─────────────────┘ │ Actions └────────┘ DOM tree └────────┘ │ └─────────────────┘ │ Actions └────────┘ DOM tree └────────┘
┌─────────────────┐ │ ▲ ┌─────────────────┐ │ ▲
│ │ Reducers │◀┼────┘ │ │ │ Reducers │◀┼──┘ │
└─────────────────┘ │ └─────────────────┘ │
│ │ │ ┌────────┐ │ │ │ │ ┌────────┐ │
└─────────────────────▶│ Router │─────────────────┘ ───────────────────▶│ Router │─────────────────┘
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ State └────────┘ State └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ State └────────┘ State
Model Model
``` ```