Skip to content

Instantly share code, notes, and snippets.

@tmeasday
Last active June 16, 2017 20:33
Show Gist options
  • Select an option

  • Save tmeasday/c65890270df0b34ad2f95eefe7458021 to your computer and use it in GitHub Desktop.

Select an option

Save tmeasday/c65890270df0b34ad2f95eefe7458021 to your computer and use it in GitHub Desktop.
function buildReduxContainer(ChildComponentClass, mapStateToProps) {
return class Container extends Component {
render() {
const { state } = this.context.store.getState();
const props = mapStateToProps(state);
return <ChildComponentClass {...this.props} {...props} />;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment