You can add/edit props passed to the component using props proxy pattern.
In this pattern, we create new props as an object, then use dot operator to deep clone it and pass it into the Wrapped component as additional props.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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} /> } } } |