export Switch (imported as Switch) was not found in react-router-dom. This problem comes from the router version. Please Check Router Version From package.json
"dependencies": {
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.4"
},
If "react-router-dom": "^6.2.2",
Then
Try it...
import {
BrowserRouter,
Routes,
Route,
Link,
Outlet
} from "react-router-dom";
See Full Code here
import './App.css';
import {Login} from "./components/Login";
import {Profile} from "./components/Profile";
import {
BrowserRouter,
Routes,
Route,
Link,
Outlet
} from "react-router-dom";
function App() {
return (
<div>
<BrowserRouter>
<Routes>
<Route exact path="/" element={<Login/>}/>
<Route exact path="/profile" element={<Profile/>}/>
</Routes>
</BrowserRouter>
</div>
);
}
export default App;
export Switch (imported as Switch) was not found in react-router-dom. This problem comes from the ro..
Get the latest news and updates by signing up to our daily newsletter.We won't sell your email or spam you !