Ad

React Js Error TypeError: React.memo Is Not A Function

- 1 answer

I am new in react js just now I have a install data-table component using npm install react-data-table-component styled-components and apply its basic example but its give me error TypeError: React.memo is not a function I have try to google its but all solutions about the redux currently I am using this my package.json file

{
    "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"
    }
}

Thanks

Ad

Answer

You are using react 16.2 but React.memo was released in 16.6. The library you are using requires the newer version of React.

Ad
source: stackoverflow.com
Ad