https://github.com/welldone-software/why-did-you-render
You can also manually track any component you want by setting whyDidYouRender on them like this:
function BigListPureComponent() {
return <div>
//some heavy component you want to ensure doesn't happen if its not neceserry
</div>
}
BigListPureComponent.whyDidYouRender = true
In TypeScript, if we want whyDidYouRender be readonly, we should write:
function BigListPureComponent() {
return <div>
//some heavy component you want to ensure doesn't happen if its not neceserry
</div>
}
namespace BigListPureComponent {
export const whyDidYouRender = true;
}
But CRA doesn't support namespace now.
https://github.com/welldone-software/why-did-you-render
In TypeScript, if we want whyDidYouRender be
readonly, we should write:But CRA doesn't support namespace now.