Last active
June 16, 2017 08:52
-
-
Save graphan/f57c65b5f56f1eeef3d196eaeb8654de to your computer and use it in GitHub Desktop.
Creating Apollo and Redux Containers without Recompose
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
export const LANG_QUERY = gql` | |
... | |
`; | |
const mapStateToProps = state => ({ | |
language: state.language, | |
}); | |
const mapDispatchToProps = dispatch => ({ | |
changeLang: (lang) => { | |
dispatch(setLanguage(lang)); | |
}, | |
}); | |
const LangWithState = connect( | |
mapStateToProps, | |
mapDispatchToProps | |
)(Lang); | |
const LangWithDataAndState = graphql(LANG_QUERY)(LangWithState); | |
export default LangWithDataAndState; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment