Skip to content

Instantly share code, notes, and snippets.

@jamesseanwright
Last active December 21, 2018 15:46
Show Gist options
  • Select an option

  • Save jamesseanwright/22453b74c3d225e8484f1c7353f57a74 to your computer and use it in GitHub Desktop.

Select an option

Save jamesseanwright/22453b74c3d225e8484f1c7353f57a74 to your computer and use it in GitHub Desktop.
Roll Your Own Redux - connect Example
const mapStateToProps = ({ isFormValid, hasQuoteError, isLoadingQuote }: StateProps) => ({
isFormValid,
hasQuoteError,
isLoadingQuote,
});
const mapDispatchToProps = (dispatch: React.Dispatch<Action>) => ({
addMessage: (message: string) => dispatch(addMessage(message)),
addRonSwansonQuote: () => dispatch(addRonSwansonQuote()),
});
export default connect(
mapStateToProps,
mapDispatchToProps,
)(MessageForm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment