Skip to content

Instantly share code, notes, and snippets.

@graphan
Last active June 16, 2017 08:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graphan/f57c65b5f56f1eeef3d196eaeb8654de to your computer and use it in GitHub Desktop.
Save graphan/f57c65b5f56f1eeef3d196eaeb8654de to your computer and use it in GitHub Desktop.
Creating Apollo and Redux Containers without Recompose
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