Skip to content

Commit 19c32d2

Browse files
authored
Merge pull request sudheerj#28 from uladzislau-stuk/mapdispatchtoprops_object_shorthand
Add object shorthand syntax for mapDispatchToProps
2 parents d126a31 + 1e24020 commit 19c32d2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,6 +3029,16 @@
30293029
}
30303030
}
30313031
```
3032+
3033+
Recommend always using the “object shorthand” form for the `mapDispatchToProps`
3034+
3035+
Redux wrap it in another function that looks like (…args) => dispatch(onTodoClick(…args)), and pass that wrapper function as a prop to your component.
3036+
3037+
```javascript
3038+
const mapDispatchToProps = ({
3039+
onTodoClick
3040+
})
3041+
```
30323042
30333043
157. ### Can I dispatch an action in reducer?
30343044

0 commit comments

Comments
 (0)