处理组件是否需要执行diff
npm install --save component-pure-render
import {Component} from 'react';
import shouldComponentUpdate from 'component-pure-render';
class ComponentName extends Component {
constructor(props) {
super(props);
this.shouldComponentUpdate = shouldComponentUpdate.bind(this);
}
render() {
return (
<div>123</div>
);
}
}
export default ComponentName;