Skip to content

Instantly share code, notes, and snippets.

@0x6a68
Last active September 8, 2017 16:39
Show Gist options
  • Save 0x6a68/aa5e08ed9c9a298de67e0db66da2ae3f to your computer and use it in GitHub Desktop.
Save 0x6a68/aa5e08ed9c9a298de67e0db66da2ae3f to your computer and use it in GitHub Desktop.
react typescript HOC
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