Presentation slides: https://docs.google.com/presentation/d/1nJlYthh6VGsCr3n5EF9lC5-_nBKHtWM8KMoCRY3aCSA/edit?usp=sharing
How to setup decorators with Create React App:
-
Update jsonconfig.js:
{ "compilerOptions": { "experimentalDecorators": true } }
-
Install craco - Create React App Config Override:
npm install @craco/craco
-
Install decorators plugin for Babel:
npm install --save-dev @babel/plugin-proposal-decorators
-
Update craco.config.js:
module.exports = { babel: { plugins: [ ["@babel/plugin-proposal-decorators", { legacy: true }], ["@babel/plugin-proposal-class-properties", { loose: true }] ] } };
-
Update package.json:
Replace react-scripts with craco for start, build, etc. commands