我该如何解决这类错误?

时间:2018-04-10 09:35:48

标签: reactjs

大家好,我正在研究反应应用程序,当我启动它时,它会向我显示此类错误here 我正在与dnd做出反应http://react-dnd.github.io/react-dnd/ 你能帮助我吗 ?并提前感谢

这是我的package.json

{
    "name": "dndexercice",
    "version": "0.1.0",
    "private": true,
    "dependencies": {
        "react": "^16.3.1",
        "react-dnd": "^2.6.0",
        "react-dnd-html5-backend": "^2.6.0",
        "react-dom": "^16.3.1",
        "react-scripts": "1.1.4"
    },
    "scripts": {
        "start": "react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test --env=jsdom",
        "eject": "react-scripts eject"
    },
    "devDependencies": {
        "babel-cli": "^6.26.0",
        "babel-eslint": "^7.2.3",
        "babel-plugin-transform-decorators": "^6.24.1",
        "babel-preset-es2016": "^6.24.1",
        "eslint": "^3.19.0",
        "eslint-config-rallycoding": "^3.2.0",
        "eslint-plugin-react": "^7.7.0"
    }
}

1 个答案:

答案 0 :(得分:2)

要使用ES7装饰器语法(@),您需要将transform-decorators plugin添加到您的babel转换器。

npm install --save-dev babel-plugin-transform-decorators

.babelrc

{
  "plugins": ["transform-decorators"]
}