Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react-router-dom v6 redirect

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

function App() {
  return (
    <Routes>
      <Route path="/home" element={<Home />} />
      <Route path="/" element={<Navigate replace to="/home" />} />
    </Routes>
  );
}
Source by gist.github.com #
 
PREVIOUS NEXT
Tagged: #redirect
ADD COMMENT
Topic
Name
3+5 =