This package has been deprecated

Author message:

WARNING: This module has been renamed to shallow-compare. Please install it instead. See https://github.com/tkh44/shallow-compare for more information.

preact-shallow-compare

1.2.0 • Public • Published

preact-shallow-compare

npm package

shallowCompare for preact. react-shallow-compare detached from React.

Example

import { h, Component } from 'preact';
import shallowCompare from 'preact-shallow-compare';
 
 
class Foo extends Component {
 
    constructor(props) {
 
        super(props);
 
        this.state = { color: 'blue' };
    }
 
    shouldComponentUpdate(nextProps, nextState) {
 
        return shallowCompare(this, nextProps, nextState);
    }
 
    render() {
 
        return h('div', null, this.state.color);
    }
 
}

Package Sidebar

Install

npm i preact-shallow-compare

Weekly Downloads

20

Version

1.2.0

License

MIT

Last publish

Collaborators

  • tkh44