Created
February 9, 2018 06:08
-
-
Save jrwebdev/6d7a763038d7035115e96ec440d34396 to your computer and use it in GitHub Desktop.
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'; | |
| interface WithBlueBackgroundProps { | |
| style?: React.CSSProperties; | |
| } | |
| const withBlueBackground = <P extends WithBlueBackgroundProps>( | |
| UnwrappedComponent: React.ComponentType<P> | |
| ) => | |
| class WithBlueBackground extends React.Component<P> { | |
| render() { | |
| return ( | |
| <UnwrappedComponent | |
| {...this.props} | |
| style={Object.assign({}, this.props.style, { | |
| backgroundColor: 'blue', | |
| })} | |
| /> | |
| ); | |
| } | |
| }; | |
| export default withBlueBackground; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment