I'm getting this error :
Error: Invariant failed: You should not use <Switch> outside a <Router>
But what's driving me crazy is the fact that My "Switch" tag actually is surrounded by "BrowserRouter"..
import {BrowserRouter, Route} from "react-router-dom";
import {Switch} from "react-router";
....
function App() {
return (
<AuthContext>
<BrowserRouter>
<div className="app">
<Switch>
<Route exact path='/login' component={Login}/>
<Route exact path='/register' component={Register}/>
</Switch>
</div>
</BrowserRouter>
</AuthContext>
);
}
When checking the router modules versions, I get this :
├─┬ connected-react-router@6.9.2 extraneous
│ └── react-router@6.0.2 deduped invalid: "^4.3.1 || ^5.0.0" from node_modules/connected-react-router
├─┬ react-router-dom@6.0.2 extraneous
│ └── react-router@6.0.2 deduped invalid: "^4.3.1 || ^5.0.0" from node_modules/connected-react-router
└── react-router@6.0.2 invalid: "^4.3.1 || ^5.0.0" from node_modules/connected-react-router extraneous