lib/index.js
function createFunctionalComponent(ctor, displayName, opts, ReactComponent) {
  var cdu = createComponentDidUpdate(displayName, opts);

  // We call the original function in the render() method,
  // and implement `componentDidUpdate` for `why-did-you-update`
  var WDYUFunctionalComponent = function (_ReactComponent) {
    _inherits(WDYUFunctionalComponent, _ReactComponent);

    function WDYUFunctionalComponent() {
      _classCallCheck(this, WDYUFunctionalComponent);

      return _possibleConstructorReturn(this, _ReactComponent.apply(this, arguments));
    }

    WDYUFunctionalComponent.prototype.render = function render() {
      return ctor(this.props, this.context);
    };

    WDYUFunctionalComponent.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) {
      cdu.call(this, prevProps, prevState, snapshot);
    };

    return WDYUFunctionalComponent;
  }(ReactComponent);

  // copy all statics from the functional component to the class
  // to support proptypes and context apis
  Object.assign(WDYUFunctionalComponent, ctor, {
    // our wrapper component needs an explicit display name
    // based on the original constructor.
    displayName: displayName
  });

  return WDYUFunctionalComponent;
}
function createFunctionalComponent(ctor, displayName, opts, ReactComponent) {
  var cdu = createComponentDidUpdate(displayName, opts);

  // We call the original function in the render() method,
  // and implement `componentDidUpdate` for `why-did-you-update`
  var WDYUFunctionalComponent = function (_ReactComponent) {
    _inherits(WDYUFunctionalComponent, _ReactComponent);

    function WDYUFunctionalComponent() {
      _classCallCheck(this, WDYUFunctionalComponent);

      return _possibleConstructorReturn(this, _ReactComponent.apply(this, arguments));
    }

    WDYUFunctionalComponent.prototype.render = function render() {
      return ctor(this.props, this.context);
    };

    WDYUFunctionalComponent.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState, snapshot) {
      cdu.call(this, prevProps, prevState, snapshot);
    };

    return WDYUFunctionalComponent;
  }(ReactComponent);

  // copy all statics from the functional component to the class
  // to support proptypes and context apis
  Object.assign(WDYUFunctionalComponent, ctor, {
    // our wrapper component needs an explicit display name
    // based on the original constructor.
    displayName: displayName
  });

  return WDYUFunctionalComponent;
}
function createFunctionalComponent ( ctor , displayName , opts , ReactComponent ) { var cdu = createComponentDidUpdate ( displayName , opts ) ; // We call the original function in the render() method, // and implement `componentDidUpdate` for `why-did-you-update` var WDYUFunctionalComponent = function ( _ReactComponent ) { _inherits ( WDYUFunctionalComponent , _ReactComponent ) ; function WDYUFunctionalComponent ( ) { _classCallCheck ( this , WDYUFunctionalComponent ) ; return _possibleConstructorReturn ( this , _ReactComponent . apply ( this , arguments ) ) ; } WDYUFunctionalComponent . prototype . render = function render ( ) { return ctor ( this . props , this . context ) ; } ; WDYUFunctionalComponent . prototype . componentDidUpdate = function componentDidUpdate ( prevProps , prevState , snapshot ) { cdu . call ( this , prevProps , prevState , snapshot ) ; } ; return WDYUFunctionalComponent ; } ( ReactComponent ) ; // copy all statics from the functional component to the class // to support proptypes and context apis Object . assign ( WDYUFunctionalComponent , ctor , { // our wrapper component needs an explicit display name // based on the original constructor. displayName : displayName } ) ; return WDYUFunctionalComponent ; }
Creates a wrapper for a React functional component
Creates a wrapper for a React functional component