Skip to content

Instantly share code, notes, and snippets.

@SBub
SBub / HOC.js
Created March 29, 2018 10:02 — forked from shotaK/HOC.js
React Higher Order Component with props validation.
import React, { Component, PropTypes } from 'React';
export const Enhance = ComposedComponent => {
class WrappedComponent extends Component {
attachFunction() {
ComposedComponent.attachFunction();
}
render() {
return <ComposedComponent {...this.props} additionalProps={this.state.additionalData} />;
}