Skip to content

Instantly share code, notes, and snippets.

@alex3165
Last active October 4, 2016 13:34
Show Gist options
  • Save alex3165/5c43891c41b98ea0ac83b34e09c4fc4a to your computer and use it in GitHub Desktop.
Save alex3165/5c43891c41b98ea0ac83b34e09c4fc4a to your computer and use it in GitHub Desktop.
class Button extends React.Component {
static defaultProps = {
color: 'blue'
}
render() {
return (
<div style={{
color: this.props.color
}}>
</div>
);
}
}
export default window['button-wrapper']
? window['button-wrapper'](Button);
: Button
// MVT define the wrapper
window['button-wrapper'] = (Component) => {
return class WrappedButton extends Component {
static defaultProps = {
...Component.defaultProps,
color: 'green'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment