N
N
Nikita2021-05-19 19:30:12
React
Nikita, 2021-05-19 19:30:12

How to enable decorators-legacy in react-create-app?

There is a freshly created react-create-app. How to enable decorator support for mobx? If any information is needed, please indicate it. I just can't imagine what could be useful.

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Karo, 2021-05-19
@Prynik

Out of the box - nothing.
https://create-react-app.dev/docs/can-i-use-decorators/
The decorators used by mobx are a standard that has not been approved and will be heavily reworked.
Those. using them is not recommended and the latest version of mobx can work without them.
If you still want to, you need to modify the babel config and add the decorators plugin there.
2 ways:
- make eject and modify the webpack config
- run CRA through a wrapper that will modify the webpack config (for example, react-app-rewired / react-scripts / craco)
https://github.com/gsoft-inc/craco/blob /master/rec...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question