Using Routes instead of Switch in react-router v6
You are using react-router-dom version 6, which replaced Switch with the Routes component
import {
BrowserRouter,
Routes, // instead of "Switch"
Route,
} from "react-router-dom";
// ...
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
</Routes>
</BrowserRouter>
Note that you now also pass your component as the element prop instead of using children.