Skip to content

Commit 2d5ee79

Browse files
committed
Merge pull request #331 from joshwcomeau/feature/injectActionsDocs
Add example to API docs for no-subscribe actions
2 parents 23be1e0 + 2c05077 commit 2d5ee79

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/api.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ Returns the wrapped component instance. Only available if you pass `{ withRef: t
106106
export default connect()(TodoApp)
107107
```
108108

109+
##### Inject all action creators (`addTodo`, `completeTodo`, ...) without subscribing to the store
110+
111+
```js
112+
import * as actionCreators from './actionCreators'
113+
114+
export default connect(null, actionCreators)(TodoApp)
115+
```
116+
109117
##### Inject `dispatch` and every field in the global state
110118

111119
>Don’t do this! It kills any performance optimizations because `TodoApp` will rerender after every action.
@@ -126,7 +134,7 @@ function mapStateToProps(state) {
126134
export default connect(mapStateToProps)(TodoApp)
127135
```
128136

129-
##### Inject `todos` and all action creators (`addTodo`, `completeTodo`, ...)
137+
##### Inject `todos` and all action creators
130138

131139
```js
132140
import * as actionCreators from './actionCreators'

0 commit comments

Comments
 (0)