I want to keep the routes of the pages in separate components and render them in app.js, but it gives a "No routes match location" warning. I'm viewing the page I want but the warning is always there.
App.js:
<div id="app">
<BrowserRouter>
<Routes>
<HomeRoutes />
</Routes>
</BrowserRouter>
</div>
HomeRoutes.js
<>
<Route path="/" element={<Home />} />
</>
CodePudding user response:
Try this:
exact when true, will only match if the path matches the location.pathname exactly
<Route exact path="/" element={<Home />} />