# render-doctor

> A React higher-order component for diagnosing unnecessary renders.

Latest version **1.0.1** (published 2016-10-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install render-doctor
pnpm add render-doctor
yarn add render-doctor
bun add render-doctor
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-10-13 |
| First published | 2016-10-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | timhwang21@gmail.com |
| Maintainers | timhwang21 |
| Keywords | react, reactjs, decorator, render, performance |

## Links

- npm: https://www.npmjs.com/package/render-doctor
- Repository: https://github.com/timhwang21/render-doctor
- Homepage: https://github.com/timhwang21/render-doctor#readme
- Issues: https://github.com/timhwang21/render-doctor/issues
- npm.io page: https://npm.io/package/render-doctor

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^15.3.2
- [lodash.isequal](https://npm.io/package/lodash.isequal.md) ^4.4.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-10-13
- 1.0.0 — 2016-10-13

## README

Render Doctor
=======

[screenshot]: images/screenshot.png

`renderDoctor` is a React higher-order component for diagnosing unnecessary renders and identifying faulty selectors. It adds a logger function to a component that lists all changed props and state. Additionally, it checks if changed props are deeply equal, to identify unnecessary renders.

## Usage

Decorate the component you are investigating with `renderDoctor`:

```javascript
import renderDoctor from 'render-doctor';

@renderDoctor
export default class ComponentToCheck extends Component {
	...component code
};
```

`renderDoctor` will then automatically send diagnoses about the decorated component's props and state to the console.

![Usage Example][screenshot]

Additionally, `renderDoctor` logs an object to the console containing the old and new props and state, as well as a property `deepEqual`, which is either `true` or an object containing the differences between the old and new objects.

When the component is in use, the internal function `compareObjects` used to compare props and state is also exported to `window` to ease debugging.

## Installation

Using npm:
```shell
$ npm i -g npm
$ npm i --save-dev render-doctor
```

---
_Source: https://npm.io/package/render-doctor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
