I'm creating my first react application, I can't find how to prevent the user from accessing a route that is not part of the application. Knowing that there are routes with authentication and others without authentication. I am using react-router-dom@6 for my routes with mandatory authentication I found.
<BrowserRouter>
<header className="App-header">
<Navigation />
</header>
<Routes>
<Route path={"/"} element={<Accueil />} />
<Route path={"notre-histoire"} element={<OurHistory />} />
<Route path={"notre-savoir-faire"} element={<OurExpertise />} />
<Route path={"l-actualite"} element={<News />} />
<Route path={"les-patisseries/les-exclusifs"} element={<Exclusifs />} />
<Route path={"les-patisseries/les-classiques"} element={<Classiques />}
<Route path={"inscription"} element={<Registration />} />
</Routes>
<Footer />
</BrowserRouter>