How to fix Error: decorators-legacy - React Native

anditorx

Andi Rustianto

Posted on June 23, 2022

How to fix Error: decorators-legacy - React Native

How to fix Error: decorators-legacy - React Native

Experimental syntax 'decorators-legacy' isn't currently enabled
Enter fullscreen mode Exit fullscreen mode

1.Install decorator in package.json

"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/preset-flow": "^7.0.0"

Enter fullscreen mode Exit fullscreen mode

2.Update babe.config.js with this

module.exports = {
  "presets": [
    "module:metro-react-native-babel-preset",
    "@babel/preset-flow"
  ],
  "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy" : true }],
    ["@babel/plugin-proposal-class-properties", { "loose" : true }],
  ]
}

Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
anditorx
Andi Rustianto

Posted on June 23, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related