Last active
June 12, 2020 16:54
-
-
Save RodrigoMattosoSilveira/1a4eea83d33d941db5bf6f378ddaa1d1 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
/* | |
* ***************************************************************************** | |
* 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