@oliasoft-open-source/why-render

1.0.6 • Public • Published

Why render?

Debugging helper functions for understanding why React components are re-rendering.

Installation

yarn add --dev @oliasoft-open-source/why-render

Note: this package is for debugging/testing only, and should not be merged into production code

Usage (React components)

To use for class components:

import { whyRender } from '@oliasoft-open-source/why-render';

componentDidUpdate(prevProps, prevState) {
  whyRender(prevProps, this.props, prevState, this.state);
}

To use for function components:

import { useWhyRender } from '@oliasoft-open-source/why-render';

const Component = (props) => {
    useWhyRender(props);
}

Usage (General explainDifferences function)

import { explainDiffernces } from '@oliasoft-open-source/why-render';

explainDiffernces(previous, current);

Readme

Keywords

none

Package Sidebar

Install

npm i @oliasoft-open-source/why-render

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

7.43 kB

Total Files

10

Last publish

Collaborators

  • mtmacdonald
  • kjeldahl
  • olegkabachii