Attempted import error: 'Switch' is not exported from 'react-router-dom'
I am using the below code snippet, this is just the code part where i am getting error
import React from 'react';
import { BrowserRouter as Router, Switch, Route, Link } from 'react-router-dom';
function App() {
return (
<Router>
<div>
<NavBar />
<Switch>
<Route path="/home" component={Home} />
</Switch>
<Footer />
</div>
</Router>
);
}
export default App;
On execution of this code i am getting error as
Attempted import error: 'Switch' is not exported from 'react-router-dom'
I had referred multiple online articles related to this and also, done whatever suggessted in them, but still facing the same issue. Not sure where the error is. I had reinstalled the react-router-dom too, but no help. Pls guide where i am wrong.