Skip to content

Commit 83d0bcd

Browse files
namhong2001markerikson
authored andcommitted
Fit bindActionCreators docs more clearly (reduxjs#3266)
Fix typo - object arguments to object properties Clear words - single function to action creator for bindActionCreatorss first argument
1 parent bf8de1f commit 83d0bcd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docs/api/bindActionCreators.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Normally you should just call [`dispatch`](Store.md#dispatch) directly on your [
66

77
The only use case for `bindActionCreators` is when you want to pass some action creators down to a component that isn't aware of Redux, and you don't want to pass [`dispatch`](Store.md#dispatch) or the Redux store to it.
88

9-
For convenience, you can also pass a single function as the first argument, and get a function in return.
9+
For convenience, you can also pass an action creator as the first argument, and get a dispatch wrapped function in return.
1010

1111
#### Parameters
1212

@@ -107,4 +107,4 @@ export default connect(state => ({ todos: state.todos }))(TodoListContainer)
107107

108108
- You might ask: why don't we bind the action creators to the store instance right away, like in classical Flux? The problem is that this won't work well with universal apps that need to render on the server. Most likely you want to have a separate store instance per request so you can prepare them with different data, but binding action creators during their definition means you're stuck with a single store instance for all requests.
109109

110-
- If you use ES5, instead of `import * as` syntax you can just pass `require('./TodoActionCreators')` to `bindActionCreators` as the first argument. The only thing it cares about is that the values of the `actionCreators` arguments are functions. The module system doesn't matter.
110+
- If you use ES5, instead of `import * as` syntax you can just pass `require('./TodoActionCreators')` to `bindActionCreators` as the first argument. The only thing it cares about is that the values of the `actionCreators` properties are functions. The module system doesn't matter.

src/bindActionCreators.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ function bindActionCreator(actionCreator, dispatch) {
1010
* may be invoked directly. This is just a convenience method, as you can call
1111
* `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
1212
*
13-
* For convenience, you can also pass a single function as the first argument,
14-
* and get a function in return.
13+
* For convenience, you can also pass an action creator as the first argument,
14+
* and get a dispatch wrapped function in return.
1515
*
1616
* @param {Function|Object} actionCreators An object whose values are action
1717
* creator functions. One handy way to obtain it is to use ES6 `import * as`

0 commit comments

Comments
 (0)