https://github.com/welldone-software/why-did-you-render
index.js
// first import
import './wdyr.js';
wdyr.js
import React from 'react';
if (process.env.NODE_ENV === 'development') {
const whyDidYouRender = require('@welldone-software/why-did-you-render');
whyDidYouRender(React, {
trackAllPureComponents: true,
});
}
Component that you want to track that isn’t a pure component:
MyComponentName.whyDidYouRender = {
logOnDifferentValues: true,
};