Skip to content

Instantly share code, notes, and snippets.

@RodrigoMattosoSilveira
Last active June 12, 2020 16:54
Show Gist options
  • Save RodrigoMattosoSilveira/1a4eea83d33d941db5bf6f378ddaa1d1 to your computer and use it in GitHub Desktop.
Save RodrigoMattosoSilveira/1a4eea83d33d941db5bf6f378ddaa1d1 to your computer and use it in GitHub Desktop.
/*
* *****************************************************************************
* GIST used to configure a typed React Redux component
* https://redux.js.org/recipes/usage-with-typescript/#usage-with-typescript
* *****************************************************************************
*/
// Comment out if not used
// interface OwnProps {
// }
// Set to null if not used
function mapStateToProps (state: RootState) {
return {
links: state.rest_links_reducer
};
}
// Set to null if not used
const mapDispatchToProps = {
todo_navigate_to_page: (navUri: string) => todo_navigate_to_page(navUri)
};
// Hook them up; note that the static typing is constrained to what is in use
const connector = connect(
mapStateToProps,
mapDispatchToProps
)
type PropsFromRedux = ConnectedProps<typeof connector>
type Props = PropsFromRedux & {}
// type Props = PropsFromRedux & {
// backgroundColor: string
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment