use react-modal error: Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined

use react-modal error: Uncaught TypeError: Cannot read property 'ReactCurrentOwner' of undefined

在做一个 react-lite 项目,我也安装了 react。想要在单击按钮时使用 react-modal 创建 window。无法工作。

错误是未捕获的类型错误:无法读取未定义的 属性 'ReactCurrentOwner'。

我试过重新安装 node_modules 和 npm 安装、更新,而不是 working.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"
  }
}

我看到你在使用 React 16.x。

Check the react-lite NPM page here

Note: react-lite dose not support React v16.x now.

这可能是您的问题。

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