Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 429 Bytes

04.HOC-props-proxy.md

File metadata and controls

19 lines (17 loc) · 429 Bytes

Higher Order Component - Props proxy

This basically helps to add/edit props passed to the Component.

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} />
    }
  }
}