在react中写装饰器的报的错,
解决办法
1 先安装
npm install customize-cra react-app-rewired @babel/plugin-proposal-decorators --save
2 在项目的根目录下新建config-overrides.js文件
加入以下代码
const { override, addDecoratorsLegacy } = require('customize-cra');
module.exports = override(addDecoratorsLegacy());
3 修改package.json文件
"scripts": {"start": "react-app-rewired start","build": "react-app-rewired build","test": "react-app-rewired test","eject": "react-app-rewired eject"},
4 重启