@neos-project/debug-reason-for-rendering

9.0.0-beta3 • Public • Published

Debug Reason For Rendering - Why does React redraw a certain component?

(by the Neos Project - http://neos.io)

Usage

  1. Ensure you have decorators enabled in your project (this is the case e.g. for create-react-app).

  2. Install the package: yarn add --dev @neos-project/debug-reason-for-rendering

  3. Import the decorator function:

import debugReasonForRendering from '@neos-project/debug-reason-for-rendering';
  1. (Option 1) Annotate your shouldComponentUpdate method with @debugReasonForRendering:
@debugReasonForRendering
shouldComponentUpdate(...args) {
    return shallowCompare(this, ...args);
}
  1. (Option 2) Annotate your PureComponent class with @debugReasonForRendering:
@debugReasonForRendering
class MyComponent extends PureComponent {
    ...
}
  1. Profit! (see Chrome console)

Screenshot, explaining why updates are triggered

License

MIT

Created with <3 by the Neos Team.

http://neos.io

Readme

Keywords

none

Package Sidebar

Install

npm i @neos-project/debug-reason-for-rendering

Weekly Downloads

10

Version

9.0.0-beta3

License

MIT

Unpacked Size

19.7 kB

Total Files

4

Last publish

Collaborators

  • neos-project