Reputation: 85
I have this code and it does not display the homepage, that is the page that comes at '/'. But if I insert the <home /> tag after the <navbar /> tag, the homepage comes.
import "./App.css";
import Navbar from "./componets/navbar";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import Home from "./pages";
import About from "./pages/about";
function App() {
return (
<Router>
<Navbar />
<Routes>
<Route path="/" exact elements={<Home />} />
<Route path="/about" exact elements={<About />} />
</Routes>
</Router>
);
}
export default App;
Upvotes: 2
Views: 2206
Reputation: 85
I have found the error. It was simple. It should be element
and not elements
. So the s
was the error. Thanks again.
Upvotes: 1