Last active
November 20, 2015 22:33
-
-
Save dlmanning/4446f936fbd13d0150be to your computer and use it in GitHub Desktop.
Connect higher-order component from internal closure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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