UNPKG

hm-react-cli

Version:

Create a Huimei React project by module

18 lines (16 loc) 487 B
import { miniCreateClass } from "./util"; import { Component } from "./Component"; import { shallowEqual } from "./shallowEqual"; export var PureComponent = miniCreateClass( function PureComponent() { this.isPureComponent = true; }, Component, { shouldComponentUpdate(nextProps, nextState) { let a = shallowEqual(this.props, nextProps); let b = shallowEqual(this.state, nextState); return !a || !b; } } );