DEV Community

Cover image for How to fix Error: decorators-legacy - React Native
Andi Rustianto
Andi Rustianto

Posted on

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

Top comments (0)