DEV Community 👩‍💻👨‍💻

Jack Pritom Soren
Jack Pritom Soren

Posted on

React Router Dom V6 Boilerplate

React Router Dom

Npm: npm install react-router-dom@6
Yarn: $ yarn add react-router-dom@6


import { BrowserRouter as Router, Route, Routes } from "react-router-dom";

const App = () => {
  return (
                <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 />} /> 

export default App;
Enter fullscreen mode Exit fullscreen mode

Follow me on : Github Linkedin

Top comments (0)

🌚 Turn on dark mode

🔠 Change your default font

📚 Adjust your experience level to see more relevant content


Head to your account's Settings to do all this and more.