Hello @Orly_MUGWANEZA
react-router-dom v6
has a bit different implementation from the one you used (I’m guessing v5
, see here).
The changes affecting your code are the Switch
component is replaced with Routes
and the Route prop component
is now element
. Also as @Gassim suggested, the import should be BrowserRouter as Router
.
import React from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import Details from './components/Details';
import EntityTable from './components/EntityTable';
const AppRouter = () => (
<Router>
<Routes>
<Route exact path="/" element={<EntityTable/>} />
<Route path="/details" element={<Details/>} />
</Routes>
</Router >
);
export default AppRouter