Created
June 19, 2021 20:34
-
-
Save sabesansathananthan/337c4e119d635d5b7562441daa4d4e62 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
// Define static function | |
WrappedComponent.staticMethod = function() {/*...*/} | |
// Use HOC now | |
const EnhancedComponent = enhance(WrappedComponent); | |
// Enhanced component does not have staticMethod | |
typeof EnhancedComponent.staticMethod === "undefined" // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment