This project demonstrates routing in React using the react-router-dom library.
It includes a navigation bar with links to Home, About, and Contact pages, where each page is rendered dynamically based on the selected route.
The active link in the navigation menu is highlighted to indicate the current page.
- Navigation menu with active link highlighting
- Separate components for:
- Home
- About
- Contact
- Implemented using:
BrowserRouterRoutesRouteNavLink
- React
- react-router-dom
- CSS (for styling)
react-routing-app/
βββ public/
β βββ index.html
β βββ favicon.ico
βββ src/
β βββ components/
β β βββ Home.jsx
β β βββ About.jsx
β β βββ Contact.jsx
β β βββ Navbar.jsx
β βββ App.jsx
β βββ style.css
β βββ main.jsx
βββ package.json
βββ vite.config.js
βββ README.md# 1οΈβ£ Create a new React project using Vite
npm create vite@latest react-routing-app -- --template react
# 2οΈβ£ Navigate into the project folder
cd react-routing-app
# 3οΈβ£ Install dependencies
npm install
# 4οΈβ£ Install React Router
npm install react-router-dom
# 5οΈβ£ Start the development server
npm run dev