To use decorators inside of your
create-react-app application, you’ll need to
ejecting doesn’t need to be scary! Quite the contrary. There are three simple steps, and it takes less than a minute.
- Eject from
- Run the following command to add the Babel plugin for decorator support.
yarn add babel-plugin-transform-decorators-legacy --dev
- In package.json, create a
babelsection and add a
pluginsarray with your new plugin:
Now, you should be able to use decorators.
And if something went terribly wrong, you can also undo eject.