Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shisama/pure-deep-equal
overwrite your component's shouldComponentUpdate to compare deeply
https://github.com/shisama/pure-deep-equal
deep-equals purecomponent react shouldcomponentupdate
Last synced: about 9 hours ago
JSON representation
overwrite your component's shouldComponentUpdate to compare deeply
- Host: GitHub
- URL: https://github.com/shisama/pure-deep-equal
- Owner: shisama
- License: mit
- Created: 2017-09-02T16:06:23.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-15T08:13:15.000Z (about 7 years ago)
- Last Synced: 2024-08-08T19:42:16.066Z (3 months ago)
- Topics: deep-equals, purecomponent, react, shouldcomponentupdate
- Language: JavaScript
- Size: 4.88 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pure-deep-equal
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/shisama/pure-deep-equal/blob/master/LICENSE)
[![npm](https://img.shields.io/npm/dt/pure-deep-equal.svg)](https://www.npmjs.com/package/pure-deep-equal)overwrite your react component's shouldComponentUpdate to compare deeply
## Why?
React.PureComponent is very useful to make your react application faster.
However, since React.PureComponent uses 'shallow comparison', render method is not invoked when values of Object or array in props or state are changed.
I think it may make some bugs and I hope to compare props or state deeply.
So, I developed this. That's more, I made this to use it as decorator because I hope to apply 'deep comparison' simply to existing codes.
I hope that this library will help you. Thanks;)## Install
```
npm install --save pure-deep-equal
```## Usage
```
import React from "react";
import PureDeepEqual from "pure-deep-equal"@PureDeepEqual
class Test extends React.Component {
// ...
}
```if you use babel but you haven't yet install `babel-plugin-transform-decorator-legacy`, install it and setup.
- install
```
npm install --save-dev babel-plugin-transform-decorator-legacy
```- setup `.babelrc`
```
"plugins": ["transform-decorators-legacy"]
```## License
This project is licensed under the terms of the
[MIT license](https://github.com/shisama/pure-deep-equal/blob/master/LICENSE)