Skip to main content
InterviewHubPRO
Section Overview
Q329

Question 329 of 407

Part 9: React Hooks Deep Dive (262 - 316)

81%
React Core & Hooks (407 Qs)•Part 9: React Hooks Deep Dive (262 - 316)

How to create props proxy for HOC component?

mid LevelCode ExampleComponentsHooks

You can add/edit props passed to the component using props proxy pattern like this:

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