With the help of this code redirect to custom page when the url of your project not found.
import React from "react"
import Home from "./Home"
import NotFonund from "./NotFonund"
import { BrowserRouter as Routes, Route, Link , Navigate} from "react-router-dom";
function RouteTest(){
<BrowserRouter>
<Routes>
<Route to="/home" element={<Home />} />
<Route to="/*" element={<NotFonund/>} />
OR
<Route to="/*" element={<Navigate to="/home">} />
</Routes>
</BrowserRouter>
}
© www.thecoderjob.com. All Rights Reserved. Designed by HTML Codex