frontend/.pnpm-store/v3/files/00/f2d4f0e75ecb0c4ae7ff7ab99ce18c8dc3988504eec06a12d3467c9715c7ee539f89b31fdf8fcddf41dfecaeac1e0ec5dc58a9e2d4da308f663b3a281bf45f

16 lines
532 B
Plaintext

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