【发布时间】:2021-01-03 22:41:21
【问题描述】:
我一直用类似的东西
class MyComponent extends React.Component {
constructor(props) {
super(props)
this.state = {
var1 : undefined,
var2 : 'etc...',
}
}
}
但今天我注意到在 VS Code 中工作时,super(props) 上有一条删除线,这是以前从未有过的!?
【问题讨论】:
-
这是我今天看到的关于这个确切问题的第二篇 SO 帖子。 Google 搜索:github.com/microsoft/TypeScript/issues/40511 看起来与用于 linting 的 typescript vscode 有问题。 Vscode 在 2020 年 8 月的更新中(就在几天前)更新为 typescript 4.0 code.visualstudio.com/updates/v1_49#_typescript-40。它有所有相关的气味。
-
当您查看 React 文档时对此有何评论?
标签: reactjs visual-studio-code react-class-based-component