Skip to content

Instantly share code, notes, and snippets.

@dlmanning
Last active November 20, 2015 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlmanning/4446f936fbd13d0150be to your computer and use it in GitHub Desktop.
Save dlmanning/4446f936fbd13d0150be to your computer and use it in GitHub Desktop.
Connect higher-order component from internal closure.
export function makeConnector (store) {
return function connect(mapStateToProps, mapDispatchToProps, mergeProps, options = {}) {
// same stuff
return function wrapWithConnect(WrappedComponent) {
return class Connect extends Component {
// same stuff
constructor(props) {
super(props)
this.store = props.store || store
// same stuff
}
// same stuff
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment