HOC react
Closed this issue · 2 comments
blade-sensei commented
HOC react
blade-sensei commented
import React from 'react';
export function WrappedAdd(WrappedComponent, {a, b}) {
return class extends React.Component {
constructor(props) {
super(props);
}
render() {
this.props.a = this.props.a++;
this.props.b = this.props.b++;
return <WrappedComponent a={this.props.a} b={this.props.b} />
}
}
}
blade-sensei commented
HOC vs render props http://www.babonaux.com/2018/02/27/cestfacile-react-router-v4-layout/