装饰器@使用

来源:3-1 高阶组件实现

azmake

2019-11-28 16:49

//.babelrc
{"presets":["react-native-stage-0/decorator-support"]}
ps:如果上面出现报错
Cannot find module 'react-native-stage-0/decorator-suppor
npm install metro-react-native-babel-preset -D
将.babelrc改为
{
  "presets": ["module:metro-react-native-babel-preset"],
   "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }]   
  ]
}



写回答 关注

1回答

  • azmake
    2019-11-28 16:50:26
    //.babelrc
    {"presets":["react-native-stage-0/decorator-support"]}
    ps:如果上面出现报错
    Cannot find module 'react-native-stage-0/decorator-suppor
    npm install metro-react-native-babel-preset -D
    将.babelrc改为
    {
      "presets": ["module:metro-react-native-babel-preset"],
       "plugins": [
        ["@babel/plugin-proposal-decorators", { "legacy": true }]   
      ]
    }


React高级教程之高阶组件

运用高阶组件编写高质量React应用

14486 学习 · 33 问题

查看课程

相似问题