React js错误TypeError:React.memo不是函数

时间:2019-11-16 17:34:15

标签: reactjs react-data-grid

我现在是React JS的新手,我有一个使用npm install react-data-table-component styled-components的安装数据表组件,并应用了其基本的example,但是它给了我一个错误TypeError: React.memo is not a function,我尝试用Google搜索它但是有关redux的所有解决方案当前我正在使用我的package.json文件

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "start": "react-scripts start",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "@babel/preset-react": "^7.0.0",
        "axios": "^0.19",
        "bootstrap": "^4.1.0",
        "cross-env": "^5.1",
        "jquery": "^3.2",
        "laravel-mix": "^4.0.7",
        "lodash": "^4.17.13",
        "popper.js": "^1.12",
        "react": "^16.2.0",
        "react-dom": "^16.2.0",
        "resolve-url-loader": "^2.3.1",
        "sass": "^1.15.2",
        "sass-loader": "^7.1.0"
    },
    "dependencies": {
        "mui-datatables": "^2.12.4",
        "react-data-table-component": "^3.9.0",
        "react-notifications-component": "^2.2.3",
        "react-router-dom": "^5.1.2",
        "styled-components": "^4.4.1"
    }
}

谢谢

1 个答案:

答案 0 :(得分:1)

您使用的是react 16.2,但React.memo在16.6中发布。您使用的库需要更新版本的React。