Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. // in action.js
  2. call_api = () => {
  3. // jquery ajax call and return promise
  4. return $.get(...)
  5. }
  6.  
  7. // in ComponentA.js
  8. const mapDispatchToProps = function (dispatch) {
  9. return {
  10. doAction = () => {
  11. dispatch(call_api(..))
  12. }
  13. ...
  14. }
  15. ...
  16. }
  17.  
  18. export const ComponentAContainer = connect(mapStateToProps, mapDispatchToProps)(ComponentA)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement