Skip to content

Instantly share code, notes, and snippets.

@sabesansathananthan
Created June 19, 2021 20:34
Show Gist options
  • Save sabesansathananthan/337c4e119d635d5b7562441daa4d4e62 to your computer and use it in GitHub Desktop.
Save sabesansathananthan/337c4e119d635d5b7562441daa4d4e62 to your computer and use it in GitHub Desktop.
How React Components Are Reused
// 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