lib/index.js
function perf(Target) {
  if (process.env.NODE_ENV === 'production') {
    return Target;
  }

  // eslint-disable-next-line global-require
  var ReactPerf = require('react-addons-perf');

  var Perf = function (_Component) {
    _inherits(Perf, _Component);

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

      return _possibleConstructorReturn(this, (Perf.__proto__ || Object.getPrototypeOf(Perf)).apply(this, arguments));
    }

    _createClass(Perf, [{
      key: 'componentDidMount',
      value: function componentDidMount() {
        ReactPerf.start();
      }
    }, {
      key: 'componentDidUpdate',
      value: function componentDidUpdate() {
        ReactPerf.stop();

        var measurements = ReactPerf.getLastMeasurements();

        ReactPerf.printWasted(measurements);
        ReactPerf.start();
      }
    }, {
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        ReactPerf.stop();
      }
    }, {
      key: 'render',
      value: function render() {
        return _react2.default.createElement(Target, this.props);
      }
    }]);

    return Perf;
  }(_react.Component);

  Perf.displayName = 'perf(' + (Target.displayName || Target.name || 'Component') + ')';
  Perf.WrappedComponent = Target;
  return Perf;
}
function perf(Target) {
  if (process.env.NODE_ENV === 'production') {
    return Target;
  }

  // eslint-disable-next-line global-require
  var ReactPerf = require('react-addons-perf');

  var Perf = function (_Component) {
    _inherits(Perf, _Component);

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

      return _possibleConstructorReturn(this, (Perf.__proto__ || Object.getPrototypeOf(Perf)).apply(this, arguments));
    }

    _createClass(Perf, [{
      key: 'componentDidMount',
      value: function componentDidMount() {
        ReactPerf.start();
      }
    }, {
      key: 'componentDidUpdate',
      value: function componentDidUpdate() {
        ReactPerf.stop();

        var measurements = ReactPerf.getLastMeasurements();

        ReactPerf.printWasted(measurements);
        ReactPerf.start();
      }
    }, {
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        ReactPerf.stop();
      }
    }, {
      key: 'render',
      value: function render() {
        return _react2.default.createElement(Target, this.props);
      }
    }]);

    return Perf;
  }(_react.Component);

  Perf.displayName = 'perf(' + (Target.displayName || Target.name || 'Component') + ')';
  Perf.WrappedComponent = Target;
  return Perf;
}
function perf ( Target ) { if ( process . env . NODE_ENV === 'production' ) { return Target ; } // eslint-disable-next-line global-require var ReactPerf = require ( 'react-addons-perf' ) ; var Perf = function ( _Component ) { _inherits ( Perf , _Component ) ; function Perf ( ) { _classCallCheck ( this , Perf ) ; return _possibleConstructorReturn ( this , ( Perf . __proto__ || Object . getPrototypeOf ( Perf ) ) . apply ( this , arguments ) ) ; } _createClass ( Perf , [ { key : 'componentDidMount' , value : function componentDidMount ( ) { ReactPerf . start ( ) ; } } , { key : 'componentDidUpdate' , value : function componentDidUpdate ( ) { ReactPerf . stop ( ) ; var measurements = ReactPerf . getLastMeasurements ( ) ; ReactPerf . printWasted ( measurements ) ; ReactPerf . start ( ) ; } } , { key : 'componentWillUnmount' , value : function componentWillUnmount ( ) { ReactPerf . stop ( ) ; } } , { key : 'render' , value : function render ( ) { return _react2 . default . createElement ( Target , this . props ) ; } } ] ) ; return Perf ; } ( _react . Component ) ; Perf . displayName = 'perf(' + ( Target . displayName || Target . name || 'Component' ) + ')' ; Perf . WrappedComponent = Target ; return Perf ; }
Wraps the passed in `Component` in a higher-order component. It can then
measure the performance of every render of the `Component`.

Can also be used as an ES2016 decorator.
@param  {ReactComponent} Component the component to wrap
@return {ReactComponent}           the wrapped component
Wraps the passed in Component in a higher - order component . It can then measure the performance of every render of the Component .