Skip to content

Commit b3db96c

Browse files
author
Vladyslav Dalechyn
authored
docs: mapDispatchToProps returning undefined (#1520)
Arrow function wasn’t returning an object, those braces were a code block.
1 parent 607f1ba commit b3db96c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,9 @@ render() {
159159
}
160160

161161
const mapDispatchToProps = dispatch => {
162-
toggleTodo: todoId => dispatch(toggleTodo(todoId))
162+
return {
163+
toggleTodo: todoId => dispatch(toggleTodo(todoId))
164+
}
163165
}
164166
```
165167

@@ -171,7 +173,9 @@ render() {
171173
}
172174

173175
const mapDispatchToProps = (dispatch, ownProps) => {
174-
toggleTodo: () => dispatch(toggleTodo(ownProps.todoId))
176+
return {
177+
toggleTodo: () => dispatch(toggleTodo(ownProps.todoId))
178+
}
175179
}
176180
```
177181

0 commit comments

Comments
 (0)