代码之家  ›  专栏  ›  技术社区  ›  Ben Beri

使用MobX decorators设置ReactJS而不使用TypeScript?

  •  0
  • Ben Beri  · 技术社区  · 6 年前

    this tutorial ,它似乎不适合我,可能是因为它过时了。

    @inject 装饰:

    ./src/index.js
    Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. If you are migrating from Babylon/Babel 6 or want to use the old decorators proposal, you should use the 'decorators-legacy' plugin instead of 'decorators'.
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   Javid Asgarov    6 年前

    使用babel和它的插件来传输你的代码。

    使用装饰者使用 @babel/plugin-proposal-decorators

    在babelrc文件的add plugins属性中:

    {
      // your other babel settings
      "plugins": ["plugin-proposal-decorators"]
    }