Skip to content

Instantly share code, notes, and snippets.

@amogower
Forked from tmeasday/connect.jsx
Created June 16, 2017 20:33
Show Gist options
  • Save amogower/d5ae2daf426f5bcb15664cd741016b57 to your computer and use it in GitHub Desktop.
Save amogower/d5ae2daf426f5bcb15664cd741016b57 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