Using ES7 Decorators as Mixins
raganwald.com
raganwald.com
The pattern is
function decorate(params) {
return (Component) => class extends React.Component {
... // some code using params
render() {
return <Component {...this.props} />
}
};
}
my2c. function decorate (Component) {
let HigherOrderComponent = React.createClass({
render () {
return <Component {...this.props} />
}
})
return HigherOrderComponent
}
as explained here: https://medium.com/@dan_abramov/mixins-are-dead-long-live-hi...Just started using ES6 in nodejs and here are people already gunning for ES7. Amazing.
Can you point me to an example without es6 classes?