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
Copy file name to clipboardExpand all lines: docs/types-and-terminology.md
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Types and terminology
2
2
=====================
3
3
4
-
This is a glossary of the core terms in Redux, along with their type signatures. Types documented using [Flow notation](http://flowtype.org/docs/quick-reference.html#_).
4
+
This is a glossary of the core terms in Redux, along with their type signatures. Types are documented using [Flow notation](http://flowtype.org/docs/quick-reference.html#_).
5
5
6
6
### State
7
7
@@ -57,12 +57,12 @@ An action creator is, quite simply, a function that creates an action. Do not co
57
57
type IntermediateAction = any
58
58
```
59
59
60
-
An *intermediate action* is a value that is sent to a dispatching function, but is not yet ready for consumption by the reducer; it will be transformed by middleware before being sent to the base `dispatch()` function. Intermediate actions are often asynchronous primitives, like a promise or a thunk, which are not dispatched themselves, but trigger dispatches once an operation has completed.
60
+
An **intermediate action** is a value that is sent to a dispatching function, but is not yet ready for consumption by the reducer; it will be transformed by middleware before being sent to the base `dispatch()` function. Intermediate actions are often asynchronous primitives, like a promise or a thunk, which are not dispatched themselves, but trigger dispatches once an operation has completed.
61
61
62
62
### Middleware
63
63
64
64
```js
65
-
type Middleware = ({ dispatch: Dispatch, getState: () => State }) =>next:Dispatch=> Dispatch
65
+
type Middleware = ({ dispatch: Dispatch, getState: () => State }) =>(next:Dispatch)=> Dispatch
66
66
```
67
67
68
68
A middleware is a higher-order function that composes a dispatch function to return a new dispatch function.
@@ -79,7 +79,7 @@ Middleware is composable using function composition.
79
79
type Store = { dispatch: Dispatch, getState: State, subscribe:Function, getReducer: Reducer, replaceReducer:void }
80
80
```
81
81
82
-
Store is an object of bound methods to an underlying class instance.
82
+
A store is an object of bound methods to an underlying class instance.
83
83
84
84
-`dispatch()` is the base dispatch function described above.
85
85
-`getState()` returns the current state of the store.
@@ -101,3 +101,7 @@ type HigherOrderStore = CreateStore
101
101
```
102
102
103
103
A higher-order store is a higher-order function that composes a store-creating function to return a new store-creating function. This is similar to middleware in that it allows you to alter the store interface in a composable way.
104
+
105
+
Higher-order stores are much the same concept as higher-order components in React.
106
+
107
+
Because a store is not an instance, but rather an plain-object collection of bound methods, copies can be easily created and modified without mutating the original store.
0 commit comments