Package:
React Router Dom
Installation
Npm: npm install react-router-dom@6
Yarn: $ yarn add react-router-dom@6
App.js
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
const App = () => {
return (
<Router>
<Routes>
<Route path="/" element={<Component_Name />} /> //home directory
<Route path="/path_name" element={<Component_Name />} />
<Route path="/path_name/:dynamic" element={<Component_Name />} /> //dynamic route
<Route path="/path_name" element={<Component_Name />} />
<Route path="/*" element={<Component_Name />} />
</Routes>
</Router>
);
};
export default App;
Top comments (0)