I need to route between 2 paths,
I installed npm install react-router
(react-router: 6.2.1 and react-router-dom: 5.2.0).
I get a error saying in the webpage Error: useRoutes() may be used only in the context of a <Router> component.
which eventually meant I din't warp my index.js file with BrowserRouter but I did.
Code: index.js
import {BrowserRouter as Router} from "react-router-dom";
ReactDOM.render(
<React.StrictMode>
<Router>
<App />
</Router>
</React.StrictMode>,
document.getElementById("root")
);
app.js
function App() {
return (
<>
<Routes>
<Route path ="/" element={<Main />} />
<Route path ="gigs" element={<Gigs />} />
</Routes>
</>
);
}