Last active
September 8, 2017 16:39
-
-
Save 0x6a68/aa5e08ed9c9a298de67e0db66da2ae3f to your computer and use it in GitHub Desktop.
react typescript HOC
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
import * as React from 'react'; | |
function simpleComponentWrap<P>( | |
Comp: React.ComponentClass<P> | React.StatelessComponent<P>, | |
): React.ComponentClass<P> { | |
return class WrappedComponent extends React.Component<P, void> { | |
render() { | |
return <Comp {...this.props} />; | |
} | |
}; | |
} | |
export default simpleComponentWrap; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment