1、安装如下插件
yarn add @babel/plugin-proposal-decorators --dev
2、配置babel.config.js
{
"presets": ["react-native"],
"plugins":[["@babel/plugin-proposal-decorators", { "legacy": true }]]
}
配置完上面的操作之后重新command+R重载程序就不会报错了,但是VSCode还是会报红,解决方案如下:
3、Error warning message: "Experimental support for decorators is a feature that is subject to change in a future release" 解决方案
进入 VSCode->Settings->User 设置,搜索experimentalDecorators
,然后勾选->ok
网友评论