Match-id-580af01343fa5bba627a04ab667a638ec280a603

This commit is contained in:
* 2022-03-21 17:50:18 +08:00 committed by *
parent d3260a4d94
commit 55dac3b56b
1 changed files with 5 additions and 1 deletions

View File

@ -1,18 +1,22 @@
/**
* Component的api setState和forceUpdate在实例生成阶段实现
*/
class Component<P,S,C> {
props: P;
context: C;
state: S | null;
refs: any;
setState: any;
forceUpdate: any;
constructor(props: P, context: C) {
this.props = props;
this.context = context;
}
setState(state: S) {
console.error('Cant not call `this.setState` in the constructor of class component, it will do nothing')
}
}
// 兼容三方件 react-lifecycles-compat它会读取 isReactComponent 属性值,不添加会导致 eview-ui 官网白屏