I want to add a simple route diagram in the react application that I have installed with vite, but I am getting an error.
Error: Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/react-router-dom.js?v=8b3cf1e8' does not provide an export named 'Switch'
import './App.css';
import {Login} from './pages/Login';
import {Register} from "./pages/Register";
import {MainLayout} from './layouts/MainLayout';
import { BrowserRouter as Router, Route,Switch } from 'react-router-dom';
function App() {
return (
<div>
<Router>
<Switch>
<Route exact path="/" component={Register} />
<Route path="/login" component={Login} />
<Route path="/dashboard" component={MainLayout} />
</Switch>
</Router>
</div>
);
};
export default App
"dependencies": {
"@reduxjs/toolkit": "^1.9.3",
"antd": "^5.3.2",
"axios": "^1.3.4",
"dotenv": "^16.0.3",
"js-base64": "^3.7.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.8.0",
"react-redux": "^8.0.5",
"react-router-dom": "^6.9.0"
}
I deleted the node/modules folder and did npm install but the problem still persists.