# react-addons-pure-render-mixin

> >**Note:** >This is a legacy React addon, and is no longer maintained. > >We don't encourage using it in new code, but it exists for backwards compatibility. >The recommended migration path is to use [`React.PureComponent`](https://facebook.github.io/re

Latest version **15.6.3** (published 2020-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-addons-pure-render-mixin
pnpm add react-addons-pure-render-mixin
yarn add react-addons-pure-render-mixin
bun add react-addons-pure-render-mixin
```

## Health

**Score 48/100 (D)** — status: abandoned.

Positive: has types package; no vulnerabilities; high maintenance score; high quality score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 15.6.3 |
| Published | 2020-12-04 |
| First published | 2015-07-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-addons-pure-render-mixin) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 250515 |
| Maintainers | gaearon, brianvaughn, fb, trueadm, sophiebits |
| Keywords | react, react-addon |

## Links

- npm: https://www.npmjs.com/package/react-addons-pure-render-mixin
- Repository: https://github.com/facebook/react
- Homepage: https://github.com/facebook/react#readme
- Issues: https://github.com/facebook/react/issues
- npm.io page: https://npm.io/package/react-addons-pure-render-mixin

## Dependencies (1)

- [object-assign](https://npm.io/package/object-assign.md) ^4.1.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

- 15.6.3 (latest) — 2020-12-04
- 15.6.0-rc.0 (15-next) — 2017-06-13
- 15.5.0-rc.2 (dev) — 2017-04-06
- 15.6.2 — 2017-09-26
- 15.6.0 — 2017-06-14
- 15.6.0-rc.1 — 2017-06-01
- 15.5.2 — 2017-04-09
- 15.5.1 — 2017-04-07
- 15.5.0-rc.1 — 2017-04-05
- 15.5.0 — 2017-03-31
- 15.5.0-alpha.0 — 2017-03-24
- 16.0.0-alpha.3 — 2017-02-23
- 16.0.0-alpha.2 — 2017-02-09
- 16.0.0-alpha.0 — 2017-01-25
- 16.0.0-alpha — 2017-01-10
- … 47 more at https://npm.io/package/react-addons-pure-render-mixin/versions

## README

# react-addons-pure-render-mixin

>**Note:**
>This is a legacy React addon, and is no longer maintained.
>
>We don't encourage using it in new code, but it exists for backwards compatibility.  
>The recommended migration path is to use [`React.PureComponent`](https://facebook.github.io/react/docs/react-api.html#react.purecomponent) instead.

**Importing**

```javascript
import PureRenderMixin from 'react-addons-pure-render-mixin'; // ES6
var PureRenderMixin = require('react-addons-pure-render-mixin'); // ES5 with npm
```

If you prefer a `<script>` tag, you can get it from `React.addons.PureRenderMixin` with:

```html
<!-- development version -->
<script src="https://unpkg.com/react-addons-pure-render-mixin/react-addons-pure-render-mixin.js"></script>

<!-- production version -->
<script src="https://unpkg.com/react-addons-pure-render-mixin/react-addons-pure-render-mixin.min.js"></script>
```

In this case, make sure to put the `<script>` tag after React.

## Overview

If your React component's render function renders the same result given the same props and state, you can use this mixin for a performance boost in some cases.

Example:

```js
const createReactClass = require('create-react-class');

createReactClass({
  mixins: [PureRenderMixin],

  render: function() {
    return <div className={this.props.className}>foo</div>;
  }
});
```

Under the hood, the mixin implements [shouldComponentUpdate](https://facebook.github.io/react/docs/component-specs.html#updating-shouldcomponentupdate), in which it compares the current props and state with the next ones and returns `false` if the equalities pass.

> Note:
>
> This only shallowly compares the objects. If these contain complex data structures, it may produce false-negatives for deeper differences. Only mix into components which have simple props and state, or use `forceUpdate()` when you know deep data structures have changed. Or, consider using [immutable objects](https://facebook.github.io/immutable-js/) to facilitate fast comparisons of nested data.
>
> Furthermore, `shouldComponentUpdate` skips updates for the whole component subtree. Make sure all the children components are also "pure".

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