React写class组件时遇到如下警告
配置装饰器解决experimentalDecorators警告问题

Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.
解决方法:
1.在vscode设置中配置


2.在项目根目录新建jsconfig.json,添加代码
{
"compilerOptions": {
"experimentalDecorators": true
}
}
重启项目就可以了
网友评论