Created
February 2, 2017 12:39
-
-
Save aliakakis/794f4880835e13b75717dba9eab3de44 to your computer and use it in GitHub Desktop.
This file contains 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 React, {Component, PropTypes} from 'react'; | |
export const EnhanceDecorator = (options) => (TargetComponent) => { | |
class EnhanceComponent extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = {}; | |
} | |
render = () => { | |
return ( | |
<ComposedComponent {...this.props} {...this.state} /> | |
); | |
}; | |
} | |
EnhanceComponent.defaultProps = { | |
}; | |
EnhanceComponent.propTypes = { | |
}; | |
return EnhanceComponent; | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ EnhanceDecorator() // Do not forget the parentheses!!!
export default class MyComponent extends React.Component {...}