react-hocs/src/HOC.js
/**
 *
 * This exports one default function which returns a modified component.
 * This function takes two arguments: component and data.
 */
This exports one default function which returns a modified component.
This function takes two arguments: component and data.
This exports one default function which returns a modified component . This function takes two arguments : component and data .
function Hoc(HocComponent, data) {
  return class extends Component {
    constructor(props) {
      super(props);
      this.state = {
        data: data,
      };
    }
    render() {
      return (
        <div>
          <HocComponent data={this.state.data} {...this.props} />
        </div>
      );
    }
  };
}
function Hoc ( HocComponent , data ) { return class extends Component { constructor ( props ) { super ( props ) ; this . state = { data : data , } ; } render ( ) { return ( < div > < HocComponent data = { this . state . data } { ... this . props } / > < / div > ) ; } } ; }
This exports one default function which returns a modified component.
This exports one default function which returns a modified component .