解决问题:react中使用装修器写法报错的问题
报错问题:
Support for the experimental syntax 'decorators-legacy' isn't currently enabled
解决方法:
第一步:安装npm install @babel/plugin-proposal-decorators
第二步:释放配置文件npm run eject
第三步:在package.json文件中找到babel,并修改添加代码
修改前:
"babel": { "presets": [ "react-app" ] }
修改后:
1 "babel": { 2 "presets": [ 3 "react-app" 4 ], 5 "plugins": [ 6 [ 7 "@babel/plugin-proposal-decorators", 8 { 9 "legacy": true 10 } 11 ] 12 ] 13 }