Skip to content
Closed
12 changes: 12 additions & 0 deletions src/isomorphic/classic/class/ReactClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ var warning = require('warning');

var MIXINS_KEY = keyOf({mixins: null});

var ReactPerf = require('ReactPerf');

/**
* Policies that describe methods in `ReactClassInterface`.
*/
Expand Down Expand Up @@ -900,6 +902,16 @@ var ReactClass = {
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
} else {
if (__DEV__) {
// spec is the user-defined component
// hijack the defined lifecycle methods and wrap with Perf
spec[methodName] = ReactPerf.measure(
spec.displayName,
methodName,
spec[methodName]
);
}
}
}

Expand Down