Skip to content

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

License

Notifications You must be signed in to change notification settings

tkh44/preact-shallow-compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

preact-shallow-compare

#Deprecated: Please use https://github.com/tkh44/shallow-compare instead

npm version

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);
    }

}

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published