Created
June 19, 2021 20:11
-
-
Save sabesansathananthan/62be6f9571edc6427c70aea3b5b010bb to your computer and use it in GitHub Desktop.
How React Components Are Reused
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
const EnhancedComponent = withRouter(connect(commentSelector)(WrappedComponent)) | |
// You can write combined tool functions | |
// compose(f, g, h) Equivalent to (...args) => f(g(h(...args))) | |
const enhance = compose( | |
// These are single-parameter HOCs | |
withRouter, | |
connect(commentSelector) | |
) | |
const EnhancedComponent = enhance(WrappedComponent) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment