# pure-render-immutable-decorator

> pure render decorator, deep comparison

Latest version **1.0.3** (published 2017-03-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install pure-render-immutable-decorator
pnpm add pure-render-immutable-decorator
yarn add pure-render-immutable-decorator
bun add pure-render-immutable-decorator
```

## 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.3 |
| Published | 2017-03-01 |
| First published | 2017-02-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | heyli |
| Maintainers | lcxfs1991, ningj |
| Keywords | react, immutable, pure render, deep compare |

## Links

- npm: https://www.npmjs.com/package/pure-render-immutable-decorator
- Repository: https://github.com/SteamerTeam/pure-render-immutable-decorator
- Homepage: https://github.com/SteamerTeam/pure-render-immutable-decorator#readme
- Issues: https://github.com/SteamerTeam/pure-render-immutable-decorator/issues
- npm.io page: https://npm.io/package/pure-render-immutable-decorator

## Dependencies (1)

- [immutable](https://npm.io/package/immutable.md) ^3.8.1

## 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.3 (latest) — 2017-03-01
- 1.0.1 — 2017-03-01
- 1.0.0 — 2017-02-28

## README

## pure-render-immutable-decorator

compare props and state automatically


### Install

```
$ npm install pure-render-immutable-decorator --save
```


### Usage

If you don't care the data in `shouldComponentUpdate`, you can just use the decorator way. But you have to install `babel-plugin-transform-decorators-legacy` plugin for compilation.

```js
import pureRender from "pure-render-immutable-decorator";

@pureRender
class List extends Component {
	constructor(props, context) {
		super(props, context);
	}

	render() {

		return (
			<div></div>
		);
	}
}

```

If you need to modify logic in `shouldComponentUpdate`, you can use it like this:

```js
import { deepCompare } from "pure-render-immutable-decorator";

class List extends Component {
	constructor(props, context) {
		super(props, context);
	}

	shouldComponentUpdate(nextProps, nextState) {

		// some logic

		var shouldUpdate = /* some logic */

		return deepCompare(this, nextProps, nextState) && shouldUpdate;

	}

	render() {

		return (
			<div></div>
		);
	}
}

```

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