Skip to content

Instantly share code, notes, and snippets.

@carlosble
Created June 7, 2017 22:00
Show Gist options
  • Save carlosble/b82add3db528a277865218a6dc7b27df to your computer and use it in GitHub Desktop.
Save carlosble/b82add3db528a277865218a6dc7b27df to your computer and use it in GitHub Desktop.
Factory
export const createPage = (serverApi, mapState) => {
return connect(
(state) => {
let mapping = {
report: state.report
};
if (typeof(mapState) === 'function'){
return Object.assign(mapping, mapState(state));
}
return mapping;
},
(dispatch) => ({
// irrelevant for this post
})
)(Page);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment