Sha256: f995f39b661db4167ac55af5d54e7b42377fe77b0d13535c6a114639c6bc1047

Contents?: true

Size: 547 Bytes

Versions: 12

Compression:

Stored size: 547 Bytes

Contents

import { Component } from 'preact';
import { shallowDiffers } from './util';

/**
 * Component class with a predefined `shouldComponentUpdate` implementation
 */
export function PureComponent(p) {
	this.props = p;
}
PureComponent.prototype = new Component();
// Some third-party libraries check if this property is present
PureComponent.prototype.isPureReactComponent = true;
PureComponent.prototype.shouldComponentUpdate = function(props, state) {
	return shallowDiffers(this.props, props) || shallowDiffers(this.state, state);
};

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
isomorfeus-preact-10.6.14 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.13 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.12 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.11 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.10 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.9 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.8 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.7 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.6 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.5 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.4 node_modules/preact/compat/src/PureComponent.js
isomorfeus-preact-10.6.3 node_modules/preact/compat/src/PureComponent.js