Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Multiple path names for a same component in React Router v6

import React from "react";
import {
  BrowserRouter as Router,
  useRoutes,
} from "react-router-dom";

const App = () => useRoutes([
    { path: "/home", element: <Home /> },
    { path: "/users", element: <Home /> },
    { path: "/widgets", element: <Home /> }
  ]);

const AppWrapper = () => (
    <Router>
      <App />
    </Router>
  );
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Multiple #path #names #component #React #Router
ADD COMMENT
Topic
Name
2+2 =