React super(props) 被弃用了吗? [英] Is React super(props) deprecated?

查看:25
本文介绍了React super(props) 被弃用了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直使用类似的东西

class MyComponent extends React.Component {
    constructor(props) {
        super(props)
        
        this.state = {
            var1 : undefined,
            var2 : 'etc...',
        }
    }
}

但是今天我在使用 VS Code 时注意到在 super(props) 上有一条划线线,这是以前从未有过的!?

But today I noticed while working in VS Code there is a strike-thru line on super(props), which was never there before !?

发生了什么变化?(弹出窗口中文档的链接不是很有帮助)

What has changed? (the link to the docs in the popup is not very helpful)

推荐答案

它看起来像一个错误.请参阅 - 这里 用于解释,并且有一个来源链接.

It looks like a bug. Please see - here for explanation and there is a link to a source.

这篇关于React super(props) 被弃用了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆