score:3

Accepted answer
import {Routes, Route, Navigate } from "react-router-dom";

function App() {
    return (
        <>
            <Routes>
                <Route path="/404" element={<div>Page Not Found/div>} />
                <Route path="*" element={<Navigate replace to="/404" />} />
            </Routes>
        </>
    );
}

score:0

// Change this:
<Switch>
  <Redirect from="about" to="about-us" />
</Switch>

// to this:
<Switch>
  <Route path="about" render={() => <Redirect to="about-us" />} />
</Switch>

Related Query

More Query from same tag