0
votes

i'm getting this error Attempted import error: 'Outlet' is not exported from 'react-router-dom

if i comment Outlet it throws Attempted import error: 'Switch' is not exported from 'react-router-dom

my package.json is

{
  "name": "react-shoe-store-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.11.2",
    "@testing-library/jest-dom": "^5.11.4",
    "@testing-library/react": "^11.1.0",
    "@testing-library/user-event": "^12.1.10",
    "axios": "^0.21.1",
    "history": "^5.0.0",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-router": "^6.0.0-beta.0",
    "react-router-dom": "^6.0.0-beta.0",
    "react-scripts": "4.0.1",
    "react-slick": "^0.27.13",
    "slick-carousel": "^1.8.1",
    "web-vitals": "^0.2.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

i have installed react-router-dom v6 but i can't configure this error

1
You need to show the code where you are importing these entities, and also no need to show all of the package.json. Just versions of the relevant libraries would be enough. I think it helps. Also, I assume you have run npm install and ensured that the dependencies are downloaded. - Nishant

1 Answers

0
votes

I can't find any info about Outlet, but Switch is exported from react-router and not react-router-dom, see here

import { Switch } from "react-router";