Guest User

Untitled

a guest
Mar 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. type DispatchProps = {
  2. selectRow: (index: number) => void,
  3. loadData: (fetchArgs: FetchArgs) => void,
  4. };
  5.  
  6. // This works
  7. const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => ({
  8. selectRow: (selectedRowIndex: number) => dispatch(actions.selectRow(selectedRowIndex)),
  9. loadData: (fetchArgs: FetchArgs) => dispatch(actions.loadData(fetchArgs)),
  10. });
  11.  
  12. // This doesn't work
  13. const mapDispatchToProps = (dispatch: Dispatch): DispatchProps => bindActionCreators({
  14. selectRow: actions.selectRow,
  15. loadData: actions.loadData,
  16. }, dispatch);
  17.  
  18. SelectRowAction [1] is incompatible with undefined [2] in the return value of property `selectRow`.
Add Comment
Please, Sign In to add comment