I want to make it so if the user enters an invalid path in the URL it automatically redirects them to the homepage.
Something like this:
<BrowserRouter>
<Routes>
<Route exact path="/" element={<Home />}/>
<Route exact path="/page" element={<page />}/>
<Route path="*" /*Go to path - "/" */ />
</Routes>
</BrowserRouter>