- 使用高阶组件做props代理.
使用高阶组件做props代理.
Props代理
使用高阶组件能帮助我们对于传入的props进行修饰后传入真正的组件(类似于middleware的概念)
function HOC(WrappedComponent) {return class Test extends Component {render() {const newProps = {title: 'New Header',footer: false,showFeatureX: false,showFeatureY: true};return <WrappedComponent {...this.props} {...newProps} />}}}
