Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

redirect in react-router-dom v6

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

function App() {
  return (
    <Routes>
      <Route path="/dashboard" element={<Dashboard />} />
      <Route path="/" element={<Navigate replace to="/dashboard" />} />
    </Routes>
  );
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #redirect
ADD COMMENT
Topic
Name
1+1 =