(by the Neos Project - http://neos.io)
-
Ensure you have decorators enabled in your project (this is the case e.g. for create-react-app).
-
Install the package:
yarn add --dev @neos-project/debug-reason-for-rendering
-
Import the decorator function:
import debugReasonForRendering from '@neos-project/debug-reason-for-rendering';
- (Option 1) Annotate your
shouldComponentUpdate
method with@debugReasonForRendering
:
@debugReasonForRendering
shouldComponentUpdate(...args) {
return shallowCompare(this, ...args);
}
- (Option 2) Annotate your
PureComponent
class with@debugReasonForRendering
:
@debugReasonForRendering
class MyComponent extends PureComponent {
...
}
- Profit! (see Chrome console)
MIT
Created with <3 by the Neos Team.