@dtinsight/dt-utils
Version:
24 lines (23 loc) • 622 B
TypeScript
/**
* 一个类装饰器,通过对 props 和 state 进行深度相等性检查,
* 自动为 React 组件实现 shouldComponentUpdate。
*
* @category Utils
* @deprecated 该装饰器已废弃。建议使用 React.memo() 或 React.PureComponent 代替。
*
* @param {any} target - 要被装饰的目标类
*
* @example
* ```typescript
* import { shouldRender } from 'dt-utils';
*
* @shouldRender
* class MyComponent extends React.Component {
* render() {
* return <div>{this.props.data}</div>;
* }
* }
* ```
*/
declare const shouldRender: (target: any) => void;
export default shouldRender;