Skip to content

Instantly share code, notes, and snippets.

@Djuki
Last active February 29, 2020 11:13
Show Gist options
  • Save Djuki/48872b8bcbfbd7f88e0c8bbda8a620f3 to your computer and use it in GitHub Desktop.
Save Djuki/48872b8bcbfbd7f88e0c8bbda8a620f3 to your computer and use it in GitHub Desktop.
// Container component map dispactch action to the presentational component props
const mapDispatchToProps = dispatch => {
return {
fetchMoreBranches: (identityId, nextPage) => dispatch(fetchMoreBranches(identityId, nextPage))
};
};
const AppContainer = connect(mapStateToProps, mapDispatchToProps)(App);
// actions
export const FETCH_MORE_BRANCHES = 'FETCH_MORE_BRANCHES';
export const SUCCESS_FETCH_BRANCHES = 'SUCCESS_FETCH_BRANCHES';
export function fetchMoreBranches(identityId, nextPage) {
return {
type: FETCH_MORE_BRANCHES,
identityId,
nextPage
};
}
export function successFetchBranches(branches, nextPage) {
return {
type: SUCCESS_FETCH_BRANCHES,
branches,
nextPage
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment