Created
August 8, 2019 10:15
-
-
Save tommmyy/1377bb2d4b45f1a28af389fe518fd6ee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One must love Dan: | |
// https://github.com/reduxjs/react-redux/issues/1252#issuecomment-488160930 | |
// bindActionCreators are not good for your codebase!? | |
const useInfo = journey => { | |
const dispatch = useDispatch(); | |
return { | |
goToStep: useCallback((...args) => dispatch(goToStep(...args)), [dispatch]), | |
goToNextStep: useCallback((...args) => dispatch(goToNextStep(...args)), [dispatch]), | |
goToPreviousStep: useCallback((...args) => dispatch(goToPreviousStep(...args)), [dispatch]), | |
submitVisibleForm: useCallback((...args) => dispatch(submitVisibleForm(...args)), [dispatch]), | |
submitJourney: useCallback((...args) => dispatch(submitJourney(...args)), [dispatch]), | |
setNumberOfSteps: useCallback((...args) => dispatch(setNumberOfSteps(...args)), [dispatch]), | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment