为什么constructor中必须含有“super”调用?
来源:3-9 【组件化】创建class类组件

Zhang_Kyra
2021-06-20
老师您好,为什么constructor中必须含有“super”调用?
constructor(props: Props) {
super(props);
this.state =
{
isOpen: false,
};
}
constructors for derived classes must contain a ‘super’ call.
写回答
1回答
-
hello 同学,你的问题我们可以在react的官方文档中找到答案:https://zh-hans.reactjs.org/docs/react-component.html#constructor
00
相似问题