Created
May 23, 2017 13:29
-
-
Save ncuillery/5684ca5002cca50b7122ebca4aa43faa to your computer and use it in GitHub Desktop.
ReactEurope2017_4
This file contains hidden or 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
// Instead of doing this... | |
const EnhancedComponent = connect(commentSelector)(withRouter(WrappedComponent)) | |
// ... you can use a function composition utility | |
// compose(f, g, h) is the same as (...args) => f(g(h(...args))) | |
const enhance = compose( | |
// These are both single-argument HOCs | |
connect(commentSelector), | |
withRouter | |
) | |
const EnhancedComponent = enhance(WrappedComponent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment