I assume you are using React Router Dom v6
since you are using Routes
instead of Switch
, in which case it should be element
, not component
, the propriety where you pass that component for that route. Also, call the component when passing it like so:
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import Sidebar from "./components/Sidebar";
import Dash from "./pages/Dash";
import Prof from "./pages/Prof";
function App() {
return (
<Router>
<Sidebar />
<Routes>
<Route path="/" exact element={<Dash />} />
<Route path="/profile" exact element={<Prof />} />
</Routes>
</Router>
);
}
export default App;
⚠️: notice it’s element={<Dash />}
and not element={Dash}
.