【问题标题】:use react-modal error: Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined使用反应模式错误:未捕获的类型错误:无法读取未定义的属性“ReactCurrentOwner”
【发布时间】:2018-12-31 07:41:15
【问题描述】:

在一个 react-lite 项目上工作,我还安装了 react。想要在点击按钮时使用 react-modal 创建一个窗口。不能工作。

Error is Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined.

我尝试重新安装node_modules,然后npm install,update,不工作。Package.json:

"devDependencies": {
    "babel-core": "^6.25.0",
    "babel-loader": "^7.0.0",
    "babel-plugin-transform-react-jsx": "^6.24.1",
    "babel-preset-env": "^1.5.2",
    "chrome-remote-interface": "^0.25.5",
    "compression-webpack-plugin": "~1.0.0",
    "copy-webpack-plugin": "~3.0.1",
    "css-loader": "^0.28.11",
    "eslint": "^3.19.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-react": "~6.9.0",
    "extract-text-webpack-plugin": "^2.1.0",
    "htmlparser": "^1.7.7",
    "jed": "^1.1.1",
    "jshint": "^2.9.5",
    "jshint-loader": "^0.8.4",
    "less": "^3.8.0",
    "less-loader": "^4.1.0",
    "po2json": "^0.4.5",
    "sass-loader": "^7.0.3",
    "sizzle": "^2.3.3",
    "stdio": "^0.2.7",
    "webpack": "^2.6.1"
  },
  "dependencies": {
    "bootstrap": "^4.1.1",
    "bootstrap-less": "^3.3.8",
    "exenv": "^1.2.2",
    "jquery": "^3.3.1",
    "moment": "^2.22.2",
    "node-sass": "^4.9.0",
    "patternfly": "^3.52.2",
    "prop-types": "^15.6.2",
    "react": "^16.0.0",
    "react-addons-css-transition-group": "^15.6.2",
    "react-addons-transition-group": "^15.6.2",
    "react-dom": "^16.0.0",
    "react-lite": "^0.15.38",
    "react-modal": "^2.2.2",
    "reactstrap": "^6.3.0",
    "strict-loader": "^1.2.0"
  }
}

【问题讨论】:

    标签: reactjs modal-dialog react-modal


    【解决方案1】:

    我看到您正在使用 React 16.x。

    Check the react-lite NPM page here

    注意:react-lite 现在不支持 React v16.x。

    这可能是您的问题。

    我不知道您的项目范围,或者您想要完成什么,但您可能会发现 Preact 是一个不错的选择。

    【讨论】:

      猜你喜欢
      • 2018-11-09
      • 2021-06-14
      • 2021-10-13
      • 1970-01-01
      • 1970-01-01
      • 2019-02-28
      • 2019-12-07
      • 2023-03-21
      • 2015-07-11
      相关资源
      最近更新 更多