Skip to content

Commit ae6f033

Browse files
Andrew Lucatimdorr
Andrew Luca
authored andcommitted
fix(docs): remove mapDispatchToProps untruthy use case (#1364)
Tried every form of `mapDispatchToProps` `dispatch` is never missing from `props`
1 parent 8a1bb58 commit ae6f033

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

docs/using-react-redux/connect-dispatching-actions-with-mapDispatchToProps.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -254,22 +254,6 @@ connect(
254254
)(Counter)
255255
```
256256

257-
### Manually Injecting `dispatch`
258-
259-
If the `mapDispatchToProps` argument is supplied, the component will no longer receive the default `dispatch`. You may bring it back by adding it manually to the return of your `mapDispatchToProps`, although most of the time you shouldn’t need to do this:
260-
261-
```js
262-
import { bindActionCreators } from 'redux'
263-
// ...
264-
265-
function mapDispatchToProps(dispatch) {
266-
return {
267-
dispatch,
268-
...bindActionCreators({ increment, decrement, reset }, dispatch)
269-
}
270-
}
271-
```
272-
273257
## Defining `mapDispatchToProps` As An Object
274258

275259
You’ve seen that the setup for dispatching Redux actions in a React component follows a very similar process: define an action creator, wrap it in another function that looks like `(…args) => dispatch(actionCreator(…args))`, and pass that wrapper function as a prop to your component.

0 commit comments

Comments
 (0)